Is there a way to programmatically quit my App? (Windows Phone 7)

后端 未结 9 1644
盖世英雄少女心
盖世英雄少女心 2020-12-07 01:23

I\'m writing a windows phone 7 app. I have \"fatal exception\" handling code where I know for sure that the app is totally busted and there\'s no point in continuing. (I\'

相关标签:
9条回答
  • 2020-12-07 01:23

    When you are trying to programatically quit a WP7 application, you need keep in mind the application certification requirements. Peter Torr has a blog post that can help with your approach. Paul Jenkins experienced issues with the MahTweets app in the Marketplace recently and he blogged about it here.

    HTH, indyfromoz

    0 讨论(0)
  • 2020-12-07 01:28

    For Windows Phone 8, simply call App.Current.Terminate();

    0 讨论(0)
  • 2020-12-07 01:35

    I suppose you can let your app throw an unhandled exception at which point, Windows Phone will automatically terminate your application.

    As for certification requirement, you can ask for exception. This method has always worked for me.

    0 讨论(0)
  • 2020-12-07 01:36
    App.Current.MainWindow.Close()
    
    0 讨论(0)
  • 2020-12-07 01:38
    App.Current.Terminate();
    

    For Windows Phone 8.1 Silverlight Apps

    0 讨论(0)
  • 2020-12-07 01:41

    Navigate to App.xaml.cs in your solution explorer and add a static method to the App class

    public static void Exit()
    {
          App.Current.Terminate();
    }
    

    so that you can call it anywhere from your application , as below

    App.Exit();
    
    0 讨论(0)
提交回复
热议问题