Windows Phone 7 tip (5)-app liftcycle

Source: Internet
Author: User

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!

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.