2013-03-12 126 views
1

這是退出應用程序的代碼。退出應用程序 - Windows Phone認證

if (NavigationService.CanGoBack) 
{ 
      while (NavigationService.RemoveBackEntry() != null) 
      { 
       NavigationService.RemoveBackEntry(); 
      } 
} 

有誰可以告訴我,如果它允許從Windows Phone認證要求的角度?

回答

3

這樣做不應該中斷正常的應用程序流程。用戶希望通過點擊後退按鈕或Windows鍵來關閉應用程序。用戶也可能希望通過快速應用切換恢復應用工作。

此外,你的方法不會退出應用程序,因爲在某一點上,你會打到主頁,它不能返回。在那之後,退回去除將不可能。

底線:不這樣做。

Peter Torr的一個很好的解釋是here

1

在我的一個應用程序中,我的任務是在用戶重置他/她的帳戶時退出。該應用程序在商店中,所以沒有問題。我敢肯定,你可以實現退出與此代碼,這將是確定:

var g = new Microsoft.Xna.Framework.Game(); 
        g.Exit(); 

只需添加引用Microsoft.Xna.Framework.Game

look at this link

5.1.2 - 應用程序關閉

The app must handle exceptions raised by the any of the managed or native System API 
and not close unexpectedly. During the certification process, the app is monitored 
for unexpected closure. An app that closes unexpectedly fails certification. The app 
must continue to run and remain responsive to user input after the exception is 
handled. 

例如,您只需要一條消息,因此將退出

相關問題