0

我的代码:

            MessageDialog msg = new MessageDialog("Are you sure to cancel the booking?", "Confirmation");
            msg.Commands.Add(new UICommand("Confirm", new UICommandInvokedHandler(CommandHandler)));
            msg.Commands.Add(new UICommand("Cancel", new UICommandInvokedHandler(CommandHandler)));
            msg.DefaultCommandIndex = 1;
            msg.CancelCommandIndex = 1;
            await msg.ShowAsync();

private async void CommandHandler(IUICommand command)
    {
        var commandLabel = command.Label;
        switch (commandLabel)
        {
            case "Confirm":
                CancelBookingTickets();
                break;
            case "Cancel":
                break;

        }


    }

 protected async void CancelBookingTickets()
    {          

            MessageDialog msg1 = new MessageDialog("The cancellation process is complete", "Complete");
            await msg1.ShowAsync();            
    }

我正在尝试在我的 Windows 8 xaml 应用程序中使用嵌套的 MessageDialog 框,但是当我到达 时msg1.ShowAsync(),它会触发一个异常,提示“访问被拒绝”。

有人可以帮我解决这个问题吗?

4

1 回答 1

1

MessageDialog您一次面临多个问题。

如何在 WinRT 中一次允许多个弹出窗口?

于 2013-04-18T08:42:10.090 回答