我正在使用Windows Phone。當我的應用程序停用並進入後臺時,我想檢測OnNavigatedFrom事件上的應用程序停用,以便在應用程序進入後臺時實現一些邏輯。我怎樣才能做到這一點?????Windows Phone應用程序停用檢測頁面
2
A
回答
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)
{
}
1
我找到了解決自己。將處理程序附加到您導航的頁面上的PhoneApplicationService.Current.Deactivated事件。
1
您可以保存從APP事件或頁面事件中停用的時間,並將其存儲在IsolatedStorage中,然後在您的應用重新激活時(OnNavigatedTo)檢索數據。
相關問題
- 1. 暫停應用程序Windows Phone 8.1
- 2. 暫停Windows Phone 8.1 Silverlight應用程序
- 3. 測試Windows Phone 7應用程序
- 4. Windows Phone 8應用程序測試
- 5. 多頁Windows Phone應用程序
- 6. 如何在Windows Phone設備上測試Windows Phone應用程序
- 7. 在windows phone應用程序的登錄頁面上使用progressbar
- 8. 在Windows Phone應用程序中向左滾動應用程序頁面
- 9. 在Windows Phone上檢測應用程序安裝
- 10. Windows phone 7應用程序空閒檢測
- 11. Windows Phone 7應用程序
- 12. windows phone 7應用程序
- 13. 檢測頁面更改爲一個頁面應用程序JS
- 14. 的Windows Phone XAML風格店 - 應用程序頁面
- 15. 將數據從Windows Phone應用程序發佈到Web頁面
- 16. Windows Phone應用程序:綁定到頁面
- 17. 滾動頁面惠斯特爲Windows Phone設計應用程序
- 18. Windows Phone 7 - 通過代碼顯示「SIM應用程序」頁面
- 19. Windows Phone應用程序欄隱藏頁面內容
- 20. Windows Phone應用程序頁面背景圖像大小
- 21. 我如何導航Windows Phone應用程序中的頁面內的頁面
- 22. 適用於Windows的Windows Phone 8應用程序表面
- 23. Windows桌面應用程序可以在Windows Phone上使用嗎?
- 24. 如何檢測使用Windows Phone應用程序在瀏覽器中加載頁面?
- 25. Windows 8應用程序和Windows Phone應用程序提交
- 26. 「Windows Phone應用程序」和「Silverlight for Windows Phone應用程序」有何區別?
- 27. Windows Phone測試框架 - NuGet - 測試新應用程序
- 28. 僅適用於Windows Phone 7的Windows Phone應用程序?
- 29. 檢測單個頁面應用程序上的應用程序版本更改
- 30. Windows Phone 8.1到通用應用程序