Windows Phone Fast Application Switching–Don’t Panic!

Windows Phone Tutorial

With Mango, the Windows Phone application life cycle changes, and that is a good thing, tombstone_istock because the change allows for Fast Application Switching (FAS).  With FAS, the user can start a new application and then return to your application without seeing the “resuming…” screen and without a discernable pause.

Getting ready for FAS is the most important step you can take, because FAS will make your application more responsive. But you only get this extra responsiveness if you test whether you are returning from the Dormant vs. the Tombstoned state.

Most of the time you’ll be returning from the Dormant state, so this is well worth doing.

You only need to do this test if your code restores application state  in response to the  Application_Activated event. In that case, be sure to add a test to see if you are returning from Dormant (rather than from Tombstoned) by testing the IsApplicationInstancePreserved flag,

private void Application_Activated(
   object sender, ActivatedEventArgs e)
{
  if ( e.IsApplicationInstancePreserved )
  {
      // do not restore application state
  }
  else
  {
     // restore application state
  }
}

If you are returning from Dormant state,  the IsApplicationInstancePreserved flag will be true, and you do not have to and do not want to restore state; your state is intact.  Not restoring state under these conditions will make your application much more responsive when the user switches away and then switches back.

Share

The computer thinks these might be related:
  1. Windows Phone Videos
  2. Migrating From WP7 to Mango–Fast Application Switching
  3. Fast Application Switching Made Easy
  4. Fast Switching and Page State in Mango
This entry was posted in Essentials, Mango, Mini-Tutorial, WindowsPhone and tagged . Bookmark the permalink.

One Response to Windows Phone Fast Application Switching–Don’t Panic!

  1. Pingback: Windows Phone Fast Application Switching–Don’t Panic! – www.nalli.net

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>