public void StartEdit(PracticeRoutine practiceRoutine) { this.practiceRoutine = practiceRoutine ?? throw new ArgumentNullException("PracticeRoutine must be provided."); LifeCycleState = practiceRoutine.Id > 0 ? EntityLifeCycleState.AsExistingEntity : EntityLifeCycleState.AsNewEntity; if (TimeSlots != null) { TimeSlots.ListChanged -= (s, e) => RaisePropertyChanged(() => TotalTimeDisplay); TimeSlots.Clear(); } foreach (var timeSlot in practiceRoutine) { TimeSlotViewModel timeSlotViewModel = new TimeSlotViewModel(timeSlot); TimeSlots.Add(timeSlotViewModel); } TimeSlots.ListChanged += (s, e) => RaisePropertyChanged(() => TotalTimeDisplay); }
public TimeSlotExerciseViewModel(TimeSlotExercise timeSlotExercise, TimeSlotViewModel timeSlotViewModel) { this.timeSlotExercise = timeSlotExercise ?? throw new ArgumentNullException("Time Slot Exercise must be provided."); this.timeSlotViewModel = timeSlotViewModel ?? throw new ArgumentNullException("Time Slot View Model must be provided."); }