简体   繁体   English

告诉Windows我不再需要在WPF应用程序中阻止其关闭

[英]Tell Windows I don't need to block its shutdown anymore in WPF application

In my WPF application I'm using SessionEnding Event to prevent from shutting Windows down when my application needs to save data. 在我的WPF应用程序中,我正在使用SessionEnding Event来防止在我的应用程序需要保存数据时关闭Windows。 It works, but I don't know how to tell Windows I don't need to block its shutdown anymore. 它可以工作,但是我不知道如何告诉Windows我不再需要阻止其关闭。 I have a bool variable that tells whether the saving is happening right now. 我有一个bool变量,它可以告诉您是否正在保存。 If I block shutdown in SessionEnding, how to close my app when it ends? 如果我在SessionEnding中阻止关机,如何在结束时关闭我的应用程序? I don't want to simply close app when saving ends cuz I don't know if user has canceled shutdown. 保存结束时,我不想简单地关闭应用程序,因为我不知道用户是否已取消关机。 Please help. 请帮忙。

When shutting down Windows only waits for your application to close. 关闭Windows时,仅等待您的应用程序关闭。 Once your application saves the data be sure to close it, Windows should detect that an continue shutting down. 一旦您的应用程序保存了数据,请确保将其关闭,Windows应检测到继续关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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