2013-04-18 4 views
0

는 내 코드 :MessageDialog는 윈도우 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();    
    } 

내 윈도우 8 XAML 응용 프로그램에서 중첩 된 MessageDialog 상자를 사용하려고하지만 난 msg1.ShowAsync()에 도달했을 때, 그것은 "라는 예외를 발생은 액세스가 거부됩니다 ".

누구든지이 문제를 해결할 수 있습니까?

답변