How to Exit windows phone 7 app? [duplicate]

2019-02-11 05:35发布

问题:

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.

回答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();


回答2:

This is what you need