To our FAQ readers, first of all Thanks for visiting and subscribing..
We are preparing for MIX11, where a lot of great Windows Phone stuff is happening.
Join us there face-to-face or follow it online, it will be fun and exciting..
We are so focused on MIX that we hardly sleep and have fallen behind on preparing FAQs to post; there fore we are taking a small break between now and MIX and will be back by April 15th…
Please stay tuned for more posts. Send us your questions (and answers) if you think you have a FAQ question. We won’t reply to all emails until 4/15, but the ones that we feel should be shared, will be posted here when we return..
Happy Windows Phone coding!!
You mentioned not to use StartupMode to detect a tombstone, how should it be done?
If you just want to detect if a tombstone happened, simply set a flag in your App’s handler to Deactivated event.
If the value of the flag has not been reset (in Activated event) , then the app was not terminated.
If the value of the flag has been reset (in Activated event) then app was terminated.
//pseudo-code;
public partial class App : Application
{
bool wasApplicationTerminated = true ;
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
wasApplicationTerminated = false;
}
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if ( wasApplicationTerminated== true )
// real tombstone, new App instance
else
// must have been a chooser that did not tombstone or a quick back.
}
}
All that said, the above check is not always useful; you most often will want to know more than whether app was tombstoned; you want to know if it was tombstoned since your pages were NavigatedFrom .. Stay tuned for that tomorrow..
Posted in tombstoning, wp7
|