public WorkoutDetailsViewModel(IMasterDetailNavigation navigationService, IMessagingService messagingService, IUnitsService units, IWorkoutRules workoutRules, IWorkoutsRepository workoutsRepository) { _navigationService = navigationService; _messagingService = messagingService; _workoutsRepository = workoutsRepository; _units = units; _workoutRules = workoutRules; Title = AppResources.WorkoutTitle; RepsUpCommand = new Command(OnRepsUp); RepsDownCommand = new Command(OnRepsDown); WeighUpCommand = new Command(OnWeighUp); WeighDownCommand = new Command(OnWeighDown); PreviousIconCommand = new Command(OnPreviousIconCommand); TargetIconCommand = new Command(OnTargetIconCommand); SaveCommand = new Command(async() => await OnSave()); TimerCommand = new Command(async() => { var parameters = new NavigationParameters { { "RestTimerItem", RestTimerItem } }; await _navigationService.NavigateToHierarchical <RestTimerViewModel>(parameters); }); }
public Statistics(IWorkoutRules workoutRules, IWorkoutsRepository workoutsRepository) { _workoutRules = workoutRules; _workoutsRepository = workoutsRepository; }
public WorkoutsViewModel( IComponentContext componentContext, IMasterDetailNavigation navigationService, IMessagingService messagingService, IDatePickerDialog datePickerDialog, IWorkoutRules workoutRules, IWorkoutsRepository workoutsRepository, IExercisesRepository exercisesRepository, ICalendarRepository calendarRepository, IRoutineDaysRepository routineDaysRepository) { _componentContext = componentContext; _navigationService = navigationService; _messagingService = messagingService; _datePickerDialog = datePickerDialog; _workoutRules = workoutRules; _workoutsRepository = workoutsRepository; _exercisesRepository = exercisesRepository; _calendarRepository = calendarRepository; _routineDaysRepository = routineDaysRepository; RestTimerItem = _componentContext.Resolve <RestTimerItem>(); Title = "One Set To Failure"; ChevronTapCommand = new Command(async(s) => { await OnChevronTapCommand(s); }); CalendarNotesCommand = new Command(async() => { await OnCalendarNotesCommand(); }); GotoDateCommand = new Command(OnGotoDateCommand); SelectItemCommand = new Command(async(item) => { await OnItemSelected(item); }); TimerCommand = new Command(async() => { var parameters = new NavigationParameters { { "RestTimerItem", RestTimerItem } }; await _navigationService.NavigateToHierarchical <RestTimerViewModel>(parameters); }); _messagingService.Subscribe <WorkoutDetailsViewModel, Workout>(this, Messages.ItemChanged, (sender, workout) => { var item = Routine.FirstOrDefault(x => x.Exercise.ExerciseId == workout.ExerciseId); if (item == null) { return; } item.Workout = null; item.Workout = workout; }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemAdded, async(sender, e) => { await Reload(); }); _messagingService.Subscribe <ExerciseDetailsViewModel, Exercise>(this, Messages.ItemChanged, async(sender, e) => { await Reload(); }); _messagingService.Subscribe <ExerciseDetailsViewModel>(this, Messages.ItemDeleted, async sender => { await Reload(); }); _messagingService.Subscribe <CalendarNotesViewModel>(this, Messages.ItemChanged, async sender => { await LoadNotes(); }); _messagingService.Subscribe <SettingsViewModel>(this, Messages.WorkoutDataCleared, async sender => { await Reload(); }); }