Is there any possibility to programatically close Silverlight application on Windows Phone 7?
Is there any possibility to programatically close Silverlight application on Windows Phone 7?
sreerajvr
Practicaly no. You can throw exception that you do not handle in catch block, and app your will terminate, but that app will be rejected in later marketplace evaluation process.
Anyway, you do not need to close your app. WP7 OS handles that. When user exit your app via back or start button, app stays in "dormant" mode, and when phone's free memory declines, OS starts with terminating dormant applications starting with oldest one. As a developer you just have to accept this kind of "housekeeping" paradigm.
For better understanding of WP7 app execution process I suggest you to read "WP7 Execution model" chapter on MSDN: http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx
And also note that there are some improvement regarding this topic in "Mango" WP7 release.
Thank you so much.
sreerajvr
Hi sreerajvr,
There is no such Managed API for closing your App. The proper way to close your app using *Back Key* allows you to close wp7 app.
Pavan Pareta
Sr. Software Engineer
http://windows-mobile-dev.blogspot.com
Hello,
If you have a particular case where the "Back" navigation doesn't meet your needs like going back to page a view where the user should be authenticated and you should exit or have a home screen and want to avoid loops of some sort with the navigation:
you can use the same method used in case you were developing a game:
Add the xna librairie as a reference.
and exit the application with this line of code:
new Game().Exit();
I didn't try yet , but maybe calling NavigationService.GoBack() on the mainpage after removing all the navigation history will close the running app.
update:
Just checked. It didn't work.
Last edited by tarhini.hassan; 2011-10-31 at 03:36.
Althought using XNA's Game.Exit() is a possibility, I wouldn't recommend it.
Actually, the Applications Guidelines (5.2.4) explains all requirements about the Back button, and all expected behaviors: http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx
The thing is, you're not allowed to exit your aplication any way you want, period. But that's great to mantain a consistency of the OS.
Sorry you lost me there.
There is no controversy. I was replying that while the back button is in fract the proper way to exit Silverlight apps, when it comes do XNA there are game that provide an exit button and that it works. The example I gave is a well known game app for windows phone that does that. There are more.
cheers
Hi
hope help this link
http://stackoverflow.com/questions/4...rogramatically