Supporting the application's activation
UWP offers a rich set of activation contracts, which enables the application to be launched by multiple actions—file type association, protocol association, sharing, and automatic startup are just a few examples.
To handle these scenarios, the App
class in a UWP application provides multiple hooks that you can override, such as OnFileActivated
(when the app is opened using a file type association), OnShareTargetActivated
(when the app is opened using a share contract), or the more generic OnActivated
, which can be used to handle all other scenarios for which there isn't a dedicated handler.
The UWP model offers dedicated hooks since, by default, applications are run in a single-instance mode. This means that if the application is running and it gets activated by another action (such as the user double-clicking on a file and then which type is associated with the app), the already activated instance will receive the information...