Esempio n. 1
0
        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);
            });
        }
Esempio n. 2
0
        public AnalysisTabbedPage(IComponentContext componentContext, IMessagingService messagingService, IScreenSizeHandler screenSizeHandler,
                                  IWorkoutsRepository workoutsRepository, IExercisesRepository exercisesRepository)
        {
            InitializeComponent();
            _componentContext    = componentContext;
            _messagingService    = messagingService;
            _screenSizeHandler   = screenSizeHandler;
            _workoutsRepository  = workoutsRepository;
            _exercisesRepository = exercisesRepository;

            Title = AppResources.AnalysisTitle;
        }
 public WorkoutsController(IWorkoutsRepository repository)
 {
     this.repository = repository;
 }
Esempio n. 4
0
 public WorkoutsController(IWorkoutsRepository repository)
 {
     this.repository = repository;
 }
 public Statistics(IWorkoutRules workoutRules, IWorkoutsRepository workoutsRepository)
 {
     _workoutRules       = workoutRules;
     _workoutsRepository = workoutsRepository;
 }
Esempio n. 6
0
        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();
            });
        }
Esempio n. 7
0
 public WorkoutRules(IUnitsService units, IWorkoutsRepository workoutsRepository)
 {
     _units = units;
     _workoutsRepository = workoutsRepository;
 }
Esempio n. 8
0
 public WorkoutsService(IWorkoutsRepository repository)
 {
     // The service always has to be constructed with the repository
     this.repository = repository;
 }
Esempio n. 9
0
 public Exporter(IExercisesRepository exercisesRepository, IWorkoutsRepository workoutsRepository, ITextStorage textStorage)
 {
     _exercisesRepository = exercisesRepository;
     _workoutsRepository  = workoutsRepository;
     _textStorage         = textStorage;
 }