Exemple #1
0
        private void RunExercise()
        {
            if (CurrentExercise == null)
            {
                //We completed the session.
                //MessageBox.Show("Session Complete. Press ESC or F11 to exit picture viewer.", "Session Complete", MessageBoxButtons.OK);
                string inf = "Session Complete. Press ESC or F11 to exit picture viewer.";
                Globals.MainForm.PictureViewerForm.ShowLocalMessage(inf);
                Stop();
                OnSessionEnd?.Invoke();
            }
            else
            {
                //invoke a first tick to start the current exercise.
                NextCard();
                //This is now called (once) by the start exercise routine
                //   OnExerciseStart?.Invoke();

                //Start the timer for subsequent Exercises.
                ExerciseTimer.Stop();
                TotalExerciseTimeMillis = (int)CurrentExercise.Duration.TotalMilliseconds;
                ExerciseTimer.Interval  = TotalExerciseTimeMillis;

                ResumeTimeMillis = Environment.TickCount;
                EndTimeMillis    = ResumeTimeMillis + ExerciseTimer.Interval;
                UpdateDurationRemaining();

                PlayState = PlayState.Playing;
                ExerciseTimer.Start();

                //Call the lambda out to the controlling view that sets the picture.
                OnExerciseStart?.Invoke();
            }
        }
Exemple #2
0
        public void Resume()
        {
            if (PlayState == PlayState.Paused)
            {
                PlayState = PlayState.Playing;
                ExerciseTimer.Start();

                ResumeTimeMillis = Environment.TickCount;
                EndTimeMillis    = ResumeTimeMillis + DurationRemaining;

                OnExerciseStart?.Invoke();
            }
            else
            {
                Globals.LogError("Error - play state was not paused before Resume() called.");
            }
        }