master.fake
master.fake

Reputation: 487

MessageDialog in Windows 8 xaml

My Code:

            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();            
    }

I am trying to use the nested MessageDialog box in my Windows 8 xaml app but when I reach to the msg1.ShowAsync(), it fires an exception saying "Access is denied".

Can anybody help me out with this problem?

Upvotes: 0

Views: 1922

Answers (1)

Farhan Ghumra
Farhan Ghumra

Reputation: 15296

You are facing problem of multiple MessageDialog at once.

How to allow for multiple popups at once in WinRT?

Upvotes: 1

Related Questions