Windows 8 开发系列 metro 程序里面没有提供关闭App的事件

App close

Generally, users don't need to close apps, they can let Windows manage them. However, users can choose to close an app using the close gesture or by pressing Alt+F4. You can't include any UI in your app to enable the user to close your app, or it won't pass the Store certification process.

There's no special event to indicate that the user has closed an app.  After an app has been closed by the user, it's suspended and terminated, entering the NotRunning state within about 10 seconds. If an app has registered an event handler for the Suspending | suspending event, it is called when the app is suspended. You can use this event handler to save relevant application and user data to persistent storage.

所以,你可以使用 Suspending 事件,在系统给出的5秒内处理你的数据。

也就是说你关了应用,应用会挂起,如果内在不够用,就会关闭你的应用了!也就是说你在挂起那处理就可以了!

原文地址:https://www.cnblogs.com/sunjunlin/p/2779013.html