只需添加对Microsoft.Xna.Framework.Game
我确定您可以使用此代码实现退出的引用,就可以了。如果您想显示消息框,您必须在主页中进行
我会做什么:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (!NetworkInterface.GetIsNetworkAvailable())
{
MessageBoxResult m = MessageBox.Show(Sorry, no internet connection is available.do you want to exit the application , "Oops...", MessageBoxButton.OKCancel);
if (m == MessageBoxResult.OK)
{
var g = new Microsoft.Xna.Framework.Game();
g.Exit();
}
}
}
您应该提供一种“温和”的关闭方式
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.
欲了解更多信息,请访问此链接