The applications running on the Windows Phone 8 operating system have a specific lifecycle, and understanding it is very important for developing applications and games. At any given time, each application is in one state and can change the state only if some particular circumstances exist. Such a concept of the application lifecycle is related to the assumption that only one application is running in the foreground at the same time. Thus, it is required to use some mechanism to suspend and resume other applications, as well as handle the states of particular pages inside them.
Available states of the application, as well as its events (marked as A) and page methods (indicated as P) are presented in the following diagram, based on http://msdn.microsoft.com/library/ff817008. It can be beneficial for further development to remember connections between states, events, and methods.
The application is, at a given time, in exactly one out of three states:
It is worth mentioning that the Running state can be changed to Dormant, for example, when the player presses the Start button. The Dormant state can be replaced with Tombstoned. The Running state is accessible from both the Dormant and Tombstoned states.
Four events related to the application are available:
An implementation of the methods called when the application-related events are fired, is available in the App.xaml.cs
file. Here, you can add your own code that is executed while the application is launching, closing, activating, or deactivating.
However, you can also perform some additional operations while the user navigates to or away from a particular page (for example, Menu or Ranks). To do this, you should override the OnNavigatedTo
or OnNavigatedFrom
methods, respectively, in a file with the C# code representing the given page.
18.118.226.66