简体   繁体   中英

Execute code when exiting Windows 8.1 App

I'm attempting to execute some code on my Windows 8.1 app on exit, when a user drags the app down normally (not the extended hold to terminate).

In Windows 8, I used the following code to clear the app's tile on exit:-

    private async void OnSuspending(object sender, SuspendingEventArgs e)
    {
        Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication().Clear();
    }

However, this code isn't called in Windows 8.1 when the way the app terminate changes.

How do I recreate my code for Windows 8.1?

In 8.1, the close gesture no longer kills the app. Instead you have to hold it at the button for 1 second and when the icons flips , the app is closed.

在此处输入图片说明

Look if the code is executed there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM