HTML and CSS Reference
In-Depth Information
FIGURE 5-8 States of a Windows Store application.
Launching an application
There are quite a few ways for the user to launch the application. The most common way is that
the user launches the application from a tileā€”the Windows 8 counterpart of an icon or shortcut.
Another possibility for the application to be launched is when the user searches for some data that
the application has exposed or when the user shares data with the application. Both tasks are usually
accomplished through items in the Charms bar. Finally, yet another possibility is that the application
gets launched because the user opened a file associated with the application.
Starting an application always causes an activated event to be fired by WinJS that you can handle
through the aforementioned onactivated event:
app.onactivated = function (args) {
...
}
Most of the time, you need to do some work during the activated event. For example, you check
the application's previous state and take appropriate actions. The following code is part of any
WinJS-based application and provides a placeholder where you then add any initialization code you
may have. Upon launch, you typically load default data.
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !==
activation.ApplicationExecutionState.terminated) {
// Initialize your application here.
} else {
...
}
// Trigger data binding (if any) throughout the page
args.setPromise(WinJS.UI.processAll());
}
};
Search WWH ::




Custom Search