What is the best way to minimise restore time when de-tombstoning? [closed]
开发者_如何转开发
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this questionSo i have a number of methods i use to minimise load time when restoring a Windows Phone 7 application when it has been tombstoned and completely closed, and a user hits the back button or (in mango) navigates to your app from the multi-tasking switcher.
What methods do you use to make sure that the user doesn't see the "Resuming..." text for a second or two?
With Mango your application will be kept in memory until the device is running low in memory. So when the user comes back you can test it in the Application_Activated method:
if (!e.IsApplicationInstancePreserved)
{ //here your code to initilize database etc.
}else{
// nothing to do !
}
You should read this page on the Execution model of Mango: http://msdn.microsoft.com/en-us/library/ff817008(v=VS.92).aspx
In any case in the application_desactived method you should save all the data because you are not sure to be kept in memory until the user comes back.
For the resuming message (and it's also valid for the startup), you should be fast as you can to display the first page to your user. Even if this first page does the heavy work (query a local database, a remote service etc...). You give to the user the impression that your application is doing something and not stuck in the splash screen.
精彩评论