How to close Message Dialog programmatically(如何以编程方式关闭消息对话框)
问题描述
我正在尝试关闭我的 WinRT 应用程序中的 MessageDialog.我注意到如果我尝试一次显示两个消息对话框,我会得到一个 UnauthorizedAccessException.为避免这种情况,我想关闭现有的消息对话框(如果它已打开).我用它来显示对话框:
I am trying to close a MessageDialog in my WinRT App. I have noticed if I attempt to show two message dialogs at once, I get an UnauthorizedAccessException. To avoid this, I want to close the existing message dialog if it is open. I use this to show the dialog:
如何关闭它?
推荐答案
与其想办法关闭它,不如试试这个为 AsyncCommand 声明一个实例变量;
instead of trying to find a way to close it, try this declare a instance variable for AsyncCommand;
然后在你的命令处理程序中,在运行你的方法之前检查命令是否为空
then in your commandhandler, before running your method check if command is null
//做事/再次尝试阻止
// do stuff/ tryagain block
这篇关于如何以编程方式关闭消息对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!