如何管理windowsphone8.1应用的onClose

How to manage the onClose of windows phone 8.1 application

我想管理我的应用程序关闭时(而不是暂停时)的行为,但我找不到任何方法来覆盖。
在此应用程序中,用户可以使用他的个人资料登录:当他在应用程序的主页并按下后退按钮时,应用程序将暂停,如果恢复则用户仍处于登录状态;我想做的是,如果应用程序关闭,用户将不再登录,如果他再次打开应用程序,他必须重新登录。
登录成功后,我是这样设置本地的:

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["Logged"] = true;

所以我想将应用程序关闭(未暂停)时记录的值设置为 "false",但正如我所说,我找不到任何类型的 "on close" 方法来覆盖。
我发现实现我想要的唯一方法是设置

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localSettings.Values["Logged"] = false;

在 App.xml.cs 中的 "OnLaunched" 方法中,但它运行不正常。

定义 Application.Suspending 事件 (https://msdn.microsoft.com/en-us/library/windows.ui.xaml.application.suspending) 的处理程序。

The system suspends your app whenever the user switches to another app or to the desktop, and resumes your app whenever the user switches back to it. However, the system can also terminate your app while it is suspended in order to free up resources.

所以没有关闭应用程序的特殊事件。