Quick Recovery of Windows Phone 8 fast resume (1)

Source: Internet
Author: User

(1) Overview

 
 

A new feature of Windows Phone 8 is fast resume.

The application scenarios of this feature are as follows:

For WP7, after a user browses the app content for a period of timeProgramClick the app icon in the menu bar, and the program starts from mainpage again,

In WP8, you can click the app icon to return to the previous page.

 
 

Reference the image on madn to explain it intuitively:


In the figure, the user enters the program, enters page1, and then returns to the desktop through the Home key. At this time, if the user clicks the main program icon a again

The following result is displayed in the WP7 system:


, The user returns to the main page before browsing the interface is cleared.

 
 

If the fast resume feature is added to the program in WP8, the user will enjoy the following experience:

 
 


The user returns to page1 again. The user experience is consistent with that when the user clicks back. This feature is conducive to increasing user experience in some aspects, so developers also have more options.

 
 

(2) How to Implement

 
 

I will explain the implementation issues based on the actual scenario. I will discuss the following two situations:

1. The program does not have secondtile, that is, the user can only start the program through applist and maintile.

2. The program has secondtile, which is short for deeplink. That is, you can directly access the non-mainpage interface through the portal.

 
 

(1) In the simplest scenario, the program does not have secondtile.

 

A. Principles

1. for WP programs, a series of events related to navigatxxx will be triggered when navigate is executed. The parameters of the navigating event in rootframe include parameters of the navigatingcanceleventargs type, you can obtain the type and URI path of the current navigation by using the attributes in this parameter, and set this parameter to cancel the current navigation.

 
 

2. In the wmappmanifest. xml file of the app, we can set the activationpolicy parameter of the program to control whether the program supports fastresume:


After this setting, the scenario mentioned in the overview will trigger navigating twice when you click maintile for the second time to enter the program. The type of the navigationmodel parameter is reset as follows:


The system will then navigate again. The navigationmode is new as follows:


 
 

B. Implementation

We can see how to deal with it. After modifying wmappmanifest. XML, we need to make the following changes in APP. XAML. CS:

First, add the navigating event processing function in Row 3.


 
 

Perform the following operations in event processing:


 
 

As mentioned above, when fast resume is set, the program will execute the navigation twice. Therefore, you need to record it when the type is reset for the first time. When the new type is executed for the second time, canceling this navigation clearly describes how to process this function:

 
 

When the second entry from maintile, cancel the mainpage navigation.


 
 

If secondtile exists in the second case, I will update it later. Thank you for your support!

If you need a demo, please leave your email and I will send it to you for study :-)

 
 

In addition, WP8 Development Exchange Group: QQ: 182659848

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.