There is : Making the app single-instanced (Part 3)
Need to help to redirect to my app when i try to open the another instance of the same app
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
2 answers
Sort by: Most helpful
-
-
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 aMicrosoft.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.