2

Possible Duplicates:
Windows Phone 7 close application
Close a WP7 application programatically?
Is there a way to programmatically quit my App? (Windows Phone 7)

Hi All, Is there any way to exit application in windows phone 7. My problem with EULA.xaml and MainPage.xaml is solved but have to exit my app on MainPage.xaml in either of the cases. Thanks in advance.

Community
  • 1
  • 1
Panache
  • 987
  • 5
  • 16
  • 35
  • I think we have enough of this question now... possible duplicate of [Is there a way to programmatically quit my App? (Windows Phone 7)](http://stackoverflow.com/questions/3993507/is-there-a-way-to-programmatically-quit-my-app-windows-phone-7) – Mick N Dec 20 '10 at 23:11
  • Please read this: http://blog.jerrynixon.com/2011/11/mango-sample-exit-application.html – Jerry Nixon Feb 20 '12 at 19:40

2 Answers2

1

There is no standard API to do this in WP7-Silverlight. The trick is that you can throw an un-handled exception and that can cause the app to break and go to start menu of WindowsPhone.

public class ExitException :Exception {}

and throw this where ever you want to quit.

throw new ExitException();
Jobi Joy
  • 49,102
  • 20
  • 108
  • 119
  • 1
    Unfortunately, however this will fail certification as Microsoft test for unhandled exceptions (http://bit.ly/gBlvSZ). – Dennis Dec 20 '10 at 17:34
0

This is what you need

Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108