Maintaining the appearance of continuity after an application has been tombstoned is one of the key challenges facing Windows Phone developers.
There are two types of application state: persistent and transient. Persistent state exists across application launches and is saved using isolated storage. Transient state is discarded when an application is closed and is stored in the Microsoft.Phone.Shell.PhoneApplicationService.State dictionary.
Transient page state should be stored when the Page.OnNavigatedFrom method is called and restored when the OnNavigatedTo method is called. Transient application state can be stored when the PhoneApplicationService.Deactivated event occurs and restored when the PhoneApplicationService.Activated event occurs.
Persistent state should be saved when transient state is saved and also when the application is closing using the PhoneApplicationService.Closing event.
In this chapter you saw an overview of the application execution model and examined the various application life cycle events, which are used to coordinate state persistence and restoration.
You saw how to enable an app to run under the lock screen and then looked at page navigation and how to optimize the user experience by using a splash screen or a loading indicator.
Finally, the chapter delved into the sample application and discussed image caching, design-time data, and consuming a simple WCF service.