protected override async void OnAppearing()
        {
            if (App.WorkoutState.StateOf(_instanceId) == WorkoutState.NotStarted)
            {
                Device.StartTimer(TimeSpan.FromSeconds(1), OnSystemTimerTick);
                App.Handle(new WorkoutStarted
                {
                    InstanceId = _instanceId,
                    Timestamp  = DateTime.Now,
                    WorkoutId  = _definition.Id
                });

                await PushNextExerciseModal();

                return;
            }

            _currentExercise++;

            if (_currentExercise == _definition.ExerciseDefinitions.Count)
            {
                App.Handle(new WorkoutCompleted
                {
                    InstanceId = _instanceId,
                    Timestamp  = DateTime.Now
                });

                DisplayResults(App.Scorecard.Load(_instanceId));
                return;
            }

            await PushNextExerciseModal();
        }
Пример #2
0
 private async Task OnResultClicked(int result)
 {
     App.Handle(new ExerciseScored
     {
         ExerciseId = _definition.Id,
         InstanceId = _workoutInstance,
         Score      = result,
         Timestamp  = DateTime.Now
     });
     await Navigation.PopModalAsync();
 }