private void Delete()
        {
            if (SelectedItem is TimeSlotViewModel)
            {
                if (dialogService.YesNoPrompt("Delete Timeslot", "Sure you want to delete this time slot and all of its contents?"))
                {
                    practiceRoutine.Remove((SelectedItem as TimeSlotViewModel).TimeSlot);
                    TimeSlots.Remove(SelectedItem as TimeSlotViewModel);
                }
            }
            else
            {
                if (dialogService.YesNoPrompt("Remove Exercise", "Sure you want to remove this exercise from the timeslot?"))
                {
                    var exerciseViewModel = SelectedItem as TimeSlotExerciseViewModel;
                    var timeSlotViewModel = exerciseViewModel.TimeSlotViewModel;

                    timeSlotViewModel.TimeSlot.Remove(exerciseViewModel.TimeSlotExercise);
                    timeSlotViewModel.Remove(exerciseViewModel);
                }
            }
        }
Exemplo n.º 2
0
 private void DeleteExercise()
 {
     try
     {
         if (dialogService.YesNoPrompt("Delete Exercise", "Sure you'd like to delete this exercise?"))
         {
             exerciseService.Remove(SelectedExercise.Id);
             ExerciseList.Remove(SelectedExercise);
         }
     }
     catch
     {
         dialogService.ExclamationMessage("Deletion Error",
                                          "Cannot delete an exercise that has already been added to routine or/and has been practiced. Archive instead.");
     }
 }