Design and Development of Windows 8 Metro-settings and preferences (3)

Source: Internet
Author: User
Modify app. onactivated

In the previous experiment, you wrotePLMCode. If the applicationProgramSuspended and terminated by the operating system. It restores the last viewed location. We need to use a similar policy to select"Rememberwhere I was", The location is restored every time the application is started.

1.OpenDefault. js, FindApp. onactivatedFunction.

2.InIf-ElseStatementIfIn theInitialize your application here:Add the following statement:

Javascript

VaR remember = appdata. Current. roamingsettings. Values ["remember"];

Remember =! Remember? False: Remember;

 

If (remember ){

VaR location = appdata. Current. roamingsettings. Values ["location"];

If (typeof (location )! = "Undefined" & location! = ""){

Contosocookbook. activationargs = location;

}

}

Note:It is called every time an application is restarted (for example, when the user starts it ).IfThe code in the statement. Instead, it is called when the application is suspended, terminated, and restarted.ElseThe code in the statement.

 

Task2-Test Results

Only the last test is left to ensure that the change is effective.

1.PressF5Run the application.

2.Display the superbutton bar and select"Settings".

3.Select"Preferences"Command.

4.Verify that"Rememberwhere I was". If not selected, select it.

5.Deselect the settings pane.

6.Navigate to the recipe page.

7.Close the application from the top of the screen. This is used to close the runningMetroApply gestures in style. If you do not use a touch screen, pressAlt-F4.

8.ReturnVisual StudioWait a few seconds until the process ends (usually10Seconds ).

9.PressF5Start the application again.

10.ConfirmContoso cookbookReturns the recipe displayed when you close it.

11.Return to the preference page and deselect"Rememberwhere I was"Check box.

12.Close the application when viewing the recipe page.

13.ReturnVisual StudioAnd wait until the process ends.

14.PressF5Start the application again.

15.Confirm to arrive at the start page, andNoThe recipe that was last viewed.

16.ReturnVisual StudioAnd stop debugging.

 

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.