1
我有這個遊戲,我正在製作涉及兩個在線玩家。如果退出申請,應通知另一方。我正在使用onsuspend事件,但它不起作用。這裏是我的代碼:Windows Store應用程序/ Metro關閉/暫停事件不起作用
public MainPage()
{
this.InitializeComponent();
Application.Current.Suspending += Current_Suspending;
// and a bunch of other stuff
}
private async void Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
{
await game.leaveGame();
}
任何幫助將不勝感激。我100%肯定game.leaveGame()函數的工作原理 - 我測試過了。
您必須在不使用* async *關鍵字的情況下進行此項工作。 – 2013-04-28 20:56:15