在消息框打开时关闭 wpf [英] shutdown wpf while messagebox open

查看:21
本文介绍了在消息框打开时关闭 wpf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在午夜自动关闭 wpf 应用程序:

I try to automatically shut down an wpf application at midnight with:

Dispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);

这在一般情况下效果很好,但是当有一个消息框打开等待用户响应时,应用程序无法关闭.有没有办法关闭应用程序而不管打开的消息框?

This works very well in general, but when there is a message box opening waiting for user response, the application fails to shutdown. Is there a way to shut down the application regardless of the opening messagebox?

推荐答案

WPF 应用程序使用

Application.Current.Shutdown();

这篇关于在消息框打开时关闭 wpf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆