How to close Message Dialog programmatically

后端 未结 1 1160
走了就别回头了
走了就别回头了 2021-01-13 07:16

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

相关标签:
1条回答
  • 2021-01-13 08:07

    instead of trying to find a way to close it, try this declare a instance variable for AsyncCommand;

    AsyncCommand command;
    
    command = md.ShowAsync();
    

    then in your commandhandler, before running your method check if command is null

    if(command!=null)
    {
    command.Cancel();
    }
    

    // do stuff/ tryagain block

    0 讨论(0)
提交回复
热议问题