/// <summary> /// Methode à exécuter lors du clic sur la commande Accueil /// </summary> public async void ExecuteDelete() { try { // Create the message dialog and set its content and title var messageDialog = new MessageDialog(IConstantes.MSG_CONFIRM_DELETE_CAL); // Add commands and set their command ids messageDialog.Commands.Add(new UICommand(IConstantes.BUTTON_CONFIRM, null, 0)); messageDialog.Commands.Add(new UICommand(IConstantes.BUTTON_CANCEL, null, 1)); // Set the command that will be invoked by default messageDialog.DefaultCommandIndex = 0; // Show the message dialog and get the event that was invoked via the async operator var commandChosen = await messageDialog.ShowAsync(); if (commandChosen.Label.Equals(IConstantes.BUTTON_CONFIRM)) { CalendarControler controler = new CalendarControler(); controler.DeleteCalendar(cal.Calendar); //on met à jour la liste des calendriers parent.DeleteCalendar(cal.Calendar); parent.SelectedWindow = new CalendarWelcome(); } } catch (Exception e) { var messageDialog = new MessageDialog(IConstantes.EXCEPTION_MSG_DELETE); messageDialog.ShowAsync(); } }
/// <summary> /// Methode à exécuter lors du clic sur la commande Accueil /// </summary> public async void ExecuteSupprimer() { try { // Create the message dialog and set its content and title var messageDialog = new MessageDialog("Êtes-vous certain de vouloir supprimer le calendrier selectionné ?", "Demande de confirmation"); // Add commands and set their command ids messageDialog.Commands.Add(new UICommand("Confirmer", null, 0)); messageDialog.Commands.Add(new UICommand("Annuler", null, 1)); // Set the command that will be invoked by default messageDialog.DefaultCommandIndex = 0; // Show the message dialog and get the event that was invoked via the async operator var commandChosen = await messageDialog.ShowAsync(); if (commandChosen.Label.Equals("Confirmer")) { CalendarControler controler = new CalendarControler(); controler.DeleteCalendar(cal.Calendar); //on met à jour la liste des calendriers parent.DeleteCalendar(cal.Calendar); parent.SelectedWindow=new CalendarWelcome(); } } catch (Exception e) { var messageDialog = new MessageDialog("Impossible de supprimer le calendrier. Vous n'êtes plus connecté à votre compte.", "Suppression impossible"); messageDialog.ShowAsync(); } }