Example #1
0
        public PracticeRoutineManagementViewModel(IPracticeRoutineService practiceRoutineService, IDialogViewService dialogService)
        {
            this.practiceRoutineService = practiceRoutineService ?? throw new ArgumentNullException("Service must be provided.");
            this.dialogService          = dialogService ?? throw new ArgumentNullException("Dialog service must be provided.");

            PracticeCommand              = new RelayCommand(Practice, () => SelectedPracticeRoutine != null);
            AddPracticeRoutineCommand    = new RelayCommand(AddPracticeRoutine, () => true);
            DeletePracticeRoutineCommand = new RelayCommand(DeletePracticeRoutine, () => SelectedPracticeRoutine != null);
            EditPracticeRoutineCommand   = new RelayCommand(EditPracticeRoutine, () => SelectedPracticeRoutine != null);
        }
        public PracticeRoutineCompositeViewModel(
            IPracticeRoutineService practiceRoutineService,
            PracticeRoutineManagementViewModel practiceRoutineManagementViewModel,
            RoutineRecorderViewModel practiceRoutineRecordingListViewModel,
            PracticeRoutineEditViewModel practiceRoutineEditViewModel, ExerciseSelectionViewModel exerciseSelectionViewModel)
        {
            this.practiceRoutineService                = practiceRoutineService;
            this.practiceRoutineManagementViewModel    = practiceRoutineManagementViewModel;
            this.practiceRoutineEditViewModel          = practiceRoutineEditViewModel;
            this.practiceRoutineRecordingListViewModel = practiceRoutineRecordingListViewModel;
            this.exerciseSelectionViewModel            = exerciseSelectionViewModel;

            Messenger.Default.Register <ExitPracticeListMessage>(this, (m) => ExitPracticeList());
            Messenger.Default.Register <ViewPracticeListMessage>(this, (m) => ViewPracticeList(m.PracticeRoutineId));
            Messenger.Default.Register <ExerciseSelectionCancelledMessage>(this, (m) => ExerciseSelectionCancelled());
            Messenger.Default.Register <ExerciseSelectedMessage>(this, (m) => ExerciseSelected(m.ExerciseId));
            Messenger.Default.Register <StartSelectingPracticeRoutineExerciseMessage>(this, (m) => StartSelectingPracticeRoutine());
            Messenger.Default.Register <StartEditingPracticeRoutineMessage>(this, (m) => StartEditingPracticeRoutine(m.PracticeRoutine));
            Messenger.Default.Register <EndEditingPracticeRoutineMessage>(this, (m) => EndEditingPracticeRoutine(m.PracticeRoutine, m.Operation, m.LifeCycleState));

            NavigationCommand = new RelayCommand <string>(NavigateTo);
            NavigateTo("Search");
        }