Project DescriptionWP7AppLifeCycleService helps WP7 applications manage tombstoning easily by doing the heavy work and with SoC (Separation of Concerns) in mind. Tombstoning becomes a piece of cake.
There are two types of states to save (to later restore) when a Windows Phone 7 Application is tombstoned: application state and page state. The main places to save that information are
OnNavigatedFrom virtual method of a page, and
Deactivated event for the application. That is what the example "Tombstoning Sample" available at
http://msdn.microsoft.com/en‐us/library/ff431744(v=VS.92).aspx does, but more complex applications, specially those using the MVVM (MovelView-ViewModel) pattern that approach does not actually work and a more complex strategy is needed:
- Whos saves application state: the ViewModel or the ModelView?
- Do we have to store state everytime navigation out of the page happens (even if navigating inside the same application), or only when the application is tombstoned?
- If we store application state on the Deactivated event but there are several pages in the stack of navigated pages, does the application class need a reference to all the ViewModel loaded?
- If we decide to always store state, what impact does that have on the performance when navigating between pages?
- If one follows the Microsoft recommandations on http://create.msdn.com/en‐
US/education/catalog/article/silverlight_application_life_cycle, then information is never stored on the Deactivated event, always on the OnNavigatedFrom virtual method, then how do we store all the application state if the method is going to be handled only by one specific page when tombstoning happens?
Implementing tombstoning can be a tricky and a task more difficult to implement than anticipated, and this WP7ApplicationLifeCycleService library tries to make that work much easier and with SoC in mind. Please check Documentation in order to get information on how to incorporate and use the library to your project.