Quick Recovery of Windows Phone 8 fast resume (2)

Source: Internet
Author: User

Continue to explain the implementation of WP8 fast resume.

 

(2) second tile

Let's first define ourProgramThe structure is as follows:


The navigation relationship is:

Mainpage-> page1-> page2

 

Mainpage can pin page2 to the desktop, so there are two program portals on the desktop:

1. Click the main icon and start the client to enter mainpage.

2. Click the second icon to go to page2.

 
 

The preceding scenario exists in most programs. In this case, if you need to enable the fast Resume function, the previous processing will have problems.

When the user browses page1 and switches out by pressing home, and then clicks the second icon, the program will cancel the navigation to page2 and return to page1, Which is logically incorrect, therefore, we need additional operations.

 
 

Solution:

 
 

The program needs to check the Start entry and determine whether it comes from the second icon Based on the entry. If yes, we need to navigate to page2 and clear the rollback stack.

 
 

DetailsCodeImplementation:

 
 

First, add the navigated event processing function in the initializephoneapplication function (the default Project template of WP8 already contains the following code.

 
 

 
 

Let's take a look at the specific code for processing this event:

 
 

 
 

Therefore, this function will check whether the current navigationmode is reset. If yes, add another navigated event for processing. (as mentioned above, if the program enables fast resume, it will cut out the program and then enter, the preceding code is used to add a navigated event processing function after the first reset-type navigation is complete, the processing function is triggered after the next type navigation is complete.

 
 

 
 

When the second navigation ends, the rollback stack is cleared.

 
 

Then let's look at the navigating operation:

 
 

 
 

The code is very simple. deeplink does not take any processing when it is found to be entered from secondtile, rather than the deeplink entry, it cancels the second navigation for intuitive display.

 
 

In the first case, the program cancels the second Navigation (the new navigation type) and does not clear the rollback Stack:

In the second case, the program does not cancel the second Navigation (the new type of navigation) and clear the rollback Stack:

 
 

The above is the processing required for fast resume when the deeplink entry exists in the program. The overall idea is clearer.

Leave a message if you have any questions.

 
 

In addition, WP8 Development Group: QQ: 182659848 welcome to join the discussion

  

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.