Exemplo n.º 1
0
 public async void PostAnnouncement(Passenger passenger)
 {
     try
     {
         if (!await AnnouncementRepository.PostAnnouncement(Title, Content, passenger))
         {
             MessageDialog messageDialog = new MessageDialog("Invalid announcement. \nPlease try again.");
             messageDialog.Commands.Add(new UICommand("Close"));
             messageDialog.CancelCommandIndex = 0;
             await messageDialog.ShowAsync();
         }
         LoadAnnouncements();
     }
     catch (Exception e)
     {
         MessageDialog messageDialog = new MessageDialog($"Couldn't establish a connection to the database. \n{e.Message}");
         messageDialog.Commands.Add(new UICommand("Close"));
         messageDialog.DefaultCommandIndex = 0;
         messageDialog.CancelCommandIndex  = 1;
         await messageDialog.ShowAsync();
     }
 }