2013-04-18 2 views
0

Мой код:MessageDialog в Windows 8 XAML

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

Я пытаюсь использовать вложенную MessageDialog окно в моем Windows 8 XAML приложения, но когда я достигаю к msg1.ShowAsync(), он запускает исключение, говоря «отказано в доступе ».

Может ли кто-нибудь помочь мне решить эту проблему?

ответ

Смежные вопросы