Program The activation example demonstrates how to activate your Metro application. For an example demonstrates how to handle activation, suspension, and recovery, see the program activation and suspension example ( Function (){
VaR APP = winjs. Application;
FunctionScenario1refresh (){
Location. Reload (True);
}
function onscenariochanged () {
/// do any necessary clean up on the output, the scenario id
/// can be obtained from sdksample. scenarioid.
sdksample. displaystatus ("");
}
function domcontentloadedhandler () {
document. getelementbyid ("scenarios "). addeventlistener ("change", /* @ static_cast (eventlistener) */ onscenariochanged, false );
}
function activatedhandler () {
/// populate the text boxes with the previusly saved values
If (App. sessionstate. person) {
document. getelementbyid ("firstname "). value = app. sessionstate. person. firstname;
document. getelementbyid ("lastname "). value = app. sessionstate. person. lastname;
}< BR >}
function checkpointhandler () {
/// these will get written out on the next checkpoint event
var person = New Object ();
person. firstname = document. getelementbyid ("firstname "). value;
person. lastname = document. getelementbyid ("lastname "). value;
app. sessionstate. person = person;
}
Document. addeventlistener ("domcontentloaded", domcontentloadedhandler,False);
App. addeventlistener ("activated", activatedhandler );
App. addeventlistener ("checkpoint", checkpointhandler );
})();
CompleteCode
/Files/risk/windows8/APP activation sample.rar