With the new version of Windows Phone – Mango the program management model has been changed. Until now there were only four states in which the application could be. At the time of restarting the application developers had to take care every time, that all data have been re-loaded. This idea was to ensure that mobile phone will be high-performance device and it will work long on batteries. The idea was and still is very correct, but has been slightly modified.

The main problem was the mismatch of this idea to reality. The question arises, whether the user uses only one application. If we consider how the use of a mobile phone looks like it turns out, that very often user is working with several alternate applications simultaneously. For this reason, in Mango the following solution has been introduced – added an additional state Dormant.

 Windows Phone Mango Application States

Source: Execution Model Overview for Windows Phone

It is an intermediate state between the state Running and Tombstoned. In this state, all threads are suspended and no processing is done. The application remains in memory, so after re-starting there no longer needs to restore its state. With such a procedure it is much faster to restore a running application.

About when the application changes the state from Dormant to the state Tombstoned decides the system. This depends of course on the memory requirements. A shortcoming of this solution is that, we can not handle this transition. What more we do not get any events, which inform us about it. This causes some redundancy because every time, when the user exits the application, we need to save the data. I think more reasonable is making an event indicating that, the application is changing the state from Dormant to the state Tombstoned. On the other hand it can be regarded as a reasonable solution because if we need to move an application to the state Tombstoned it is enough to free memory only. We do not need to run the application, to save necessary data.

The return of application from the state Dormant and Tombstoned is indicated by the same event – Activated. In order to ensure correct handling for the mechanism Fast Application Switching – FAS – we need to check from which state the application is restored. To do this, we use the parameter IsApplicationInstancePreserved, which can be obtained from the arguments passed when calling the event Activate. Below code implementing the mechanism FAS.


private void Application_Activated(object sender, ActivatedEventArgs e)
    if (!e.IsApplicationInstancePreserved )
        // restore application state

As you can see the implementation of this solution is very simple and should not be inconvenient.