Exemple #1
0
        private void CreateWalkerGuy()
        {
            WalkingGuyTimer            = new Timer();
            WalkingGuyTimer.Interval   = 60;
            WalkingGuyInitialYFromBase = _pbWalkingGuy.Location.Y - Height;

            WalkingGuyTimer.Tick += (x, y) =>
            {
                int xspd = 5;
                _pbWalkingGuy.Location = new Point(_pbWalkingGuy.Location.X + xspd, Height + WalkingGuyInitialYFromBase);
                if (_pbWalkingGuy.Location.X > Width)
                {
                    _pbWalkingGuy.Location = new Point(-_pbWalkingGuy.Width, Height + WalkingGuyInitialYFromBase);
                }

                if (Sequencer != null && Sequencer.PlayState == PlayState.Playing)
                {
                    if (PictureViewerForm != null)
                    {
                        if (Sequencer != null)
                        {
                            float f = (float)(Sequencer.ElapsedMillis) / (float)(Sequencer.TotalExerciseTimeMillis);

                            PictureViewerForm.RepaintTimerPie(f);
                        }
                    }
                }
                else
                {
                    //*Hide the Pie
                    PictureViewerForm.RepaintTimerPie(0);
                }
            };
            WalkingGuyTimer.Stop();
        }
Exemple #2
0
        public void PlayPauseAction()
        {
            if (this.SettingsForm.FileCache.Files.Count == 0)
            {
                MessageBox.Show("Could not start session, no images were found.  Create a list of images by going to Settings and clicking 'Search'", "No images found.", MessageBoxButtons.OK);
            }
            if (GetSelectedSession() == null)
            {
                MessageBox.Show("Select a session in the dropdown box to start it.  " +
                                "If you don't have any sessions you can create one by clicking the Sessions button at the top.");
            }
            else
            {
                if (Sequencer == null || Sequencer.PlayState == PlayState.Stopped)
                {
                    if (PictureViewerForm == null)
                    {
                        PictureViewerForm = new PictureViewerForm();
                        PictureViewerForm.Show();
                    }

                    //We are initially starting a play.  if stopped reset sequencer to load fresh data.
                    Sequencer = new Sequencer(
                        GetSelectedSession(),
                        () =>
                    {
                        //onShuffle
                        //UpdatePlaylist
                        _lsvPlaylist.Items.Clear();
                        foreach (string card in Sequencer.Cards)
                        {
                            _lsvPlaylist.Items.Add(card);
                        }
                    },
                        () =>
                    {
                        //OnExerciseStart

                        //CycleImage
                        if (PictureViewerForm == null)
                        {
                            PictureViewerForm = new PictureViewerForm();
                        }

                        //If we are a pause exercise then set no image and TakeABreak it
                        if (Sequencer.CurrentExercise != null)
                        {
                            if (Sequencer.CurrentExercise.TakeABreak)
                            {
                                PictureViewerForm.SetImage(null);
                                PictureViewerForm.InstructionText = "Take a break.";
                            }
                            else
                            {
                                PictureViewerForm.SetImage(Sequencer.CurrentCard);
                                PictureViewerForm.InstructionText = Sequencer.CurrentExercise.Instruction;
                            }
                        }
                        else
                        {
                            PictureViewerForm.SetImage(null);
                            PictureViewerForm.InstructionText = "No more exercises.";
                        }
                    },
                        () =>
                    {
                        //OnSessionEnd
                        StopTimerAction();
                        //Hide the PI
                        PictureViewerForm?.RepaintTimerPie(0);
                    }
                        );
                }

                if (Sequencer.PlayState == PlayState.Playing)
                {
                    PauseTimer();
                }
                else if (Sequencer.PlayState == PlayState.Paused)
                {
                    ResumeTimer();
                }
                else if (Sequencer.PlayState == PlayState.Stopped)
                {
                    StartTimer();
                }
            }
        }