An example of the new trainning kit is clear:
1. application_launching: only when the new startupProgramTrigger
2. application_closing: triggered only when the program is released-Press the hard back key only when the program mainpage is launched.
3. application_activated: Exit from the Home key or other methods. triggered when the back key is returned.
4. application_deactivated: triggered when you exit from the Home key or other methods
Application_launching and application_activated are mutually exclusive and will not be triggered at the same time; so are application_closing and application_deactivated!
There are two trigger events at page level, namely when the page is left and when the page is returned.
Protected Override VoidOnnavigatedfrom (navigationeventargs E)
Protected Override VoidOnnavigatedto (navigationeventargs E)
Basic principle: store the state of the app or page in the corresponding exit event handling method and read it when returning. For example, if the app has a list and the previously stored data needs to be displayed when a new program is started or returned
Application_activated reads data from local storage. The former must be implemented by yourself, and the latter must be supported by phoneapplicationservice. In fact, if you track the app lifecycle, you will find that the app and page will be initialized whether the app is newly started or returned from other places, reading the stored data in the corresponding constructor is actually the most suitable and suitable for all situations!