2

私はWindows Phoneで作業しています。アプリケーションが非アクティブ化されてバックグラウンドに移行したときに、OnNavigatedFrom イベントでアプリケーションの非アクティブ化を検出して、アプリケーションがバックグラウンドに移行した場合にロジックを実装できるようにしたいと考えています。これどうやってするの?????

4

3 に答える 3

1

APPイベントまたはページイベントから非アクティブ化する時間を節約し、それをIsolatedStorageに保存してから、アプリが再アクティブ化されたときにデータを取得できます(OnNavigatedTo)。

于 2013-03-04T08:10:45.847 に答える
1

私は自分で解決策を見つけました。ナビゲート元のページの PhoneApplicationService.Current.Deactivated イベントにハンドラーをアタッチします。

于 2013-03-04T05:33:51.820 に答える
0

次のメソッド (App.xaml.cs ファイルにあります) を使用して、アプリがアクティブ化または非アクティブ化されたときにロジックを実行します。

// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{

}

// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{

}

// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{

}

// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{

}
于 2013-03-04T05:24:23.057 に答える