Need to help to redirect to my app when i try to open the another instance of the same app

Sunil A M 171 Reputation points
2023-08-29T14:51:36.5166667+00:00

Hi Team,

Could you please guide me how to redirect to the same instance of the Winui3 app(which will be already running) when i try to open the another instance of the same app...

Basically i need to immediately redirect to the currently running app(should activate and come to the front) when i open the another instance of the same app.

Best Regards,

Sunil

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
752 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 83,206 Reputation points
    2023-08-29T21:00:20.9833333+00:00

  2. Jeanine Zhang-MSFT 9,431 Reputation points Microsoft Vendor
    2023-08-31T06:58:45.7566667+00:00

    Hello,

    Welcome to Microsoft Q&A!

    In order to handle reactivation, the app can register for an Activated event. The event passes a Microsoft.Windows.AppLifecycle.AppActivationArguments instance to the app, which contains one of the -ActivatedEventArgs instances.

    When a registered activation is triggered, an instance of AppActivationArguments Class is passed to the event handler for the Activated event of the AppInstance class.

    For more details, I suggest you could refer to the Doc:App instancing with the app lifecycle API.

    You could refer to the sample: Handling activations.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.