Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 public void ToggleFullscreenAction()
 {
     if (PictureViewerForm != null)
     {
         if (PictureViewerForm.Fullscreen == true)
         {
             PictureViewerForm.ToggleFullscreen(false);
         }
     }
 }
Ejemplo n.º 3
0
 private void SetupShortcuts()
 {
     Shortcuts = new Dictionary <Keys, Action>();
     Shortcuts.Add(Keys.F5, PlayPauseAction);
     Shortcuts.Add(Keys.Escape, ToggleFullscreenAction);
     Shortcuts.Add(Keys.F11, ToggleFullscreenAction);
     Shortcuts.Add(Keys.Space, PlayPauseAction);
     Shortcuts.Add(Keys.Right, () => { Globals.MainForm.Sequencer.SkipToNextCard(); });
     Shortcuts.Add(Keys.Left, () => { Globals.MainForm.Sequencer.SkipToPrevCard(); });
     Shortcuts.Add(Keys.E, () => { Globals.MainForm.Sequencer.ExcludeCurrentCard(); });
     Shortcuts.Add(Keys.F, () =>
     {
         Globals.MainForm.Sequencer.ToggleFavoriteCurrentCard(); PictureViewerForm?.UpdateFavImage();
     });
 }
Ejemplo n.º 4
0
        private void StopTimerAction(bool closeViewer = false)
        {
            Sequencer.Stop();

            _cboSessions.Enabled = _btnSession.Enabled = _btnSettings.Enabled = true;
            Globals.ToggleBackground(_btnSession, true);
            Globals.ToggleBackground(_btnSettings, true);
            _btnPlay.BackgroundImage = new Bitmap(Properties.Resources.appbar_timer_play);
            WalkingGuyTimer.Stop();
            _pbWalkingGuy.Visible = false;
            _btnStop.Visible      = false;
            if (PictureViewerForm != null && closeViewer)
            {
                PictureViewerForm.Close();
                PictureViewerForm = null;
            }
        }
Ejemplo n.º 5
0
        private void ResumeTimer()
        {
            Sequencer.Resume();

            _cboSessions.Enabled = _btnSession.Enabled = _btnSettings.Enabled = false;
            Globals.ToggleBackground(_btnSession, false);
            Globals.ToggleBackground(_btnSettings, false);
            _btnPlay.BackgroundImage = new Bitmap(Properties.Resources.appbar_timer_pause);
            _pbWalkingGuy.Enabled    = true;

            _btnStop.Visible = true;

            //Show Walking Guy Loading bar.
            _pbWalkingGuy.Location = new Point(-_pbWalkingGuy.Width, _pbWalkingGuy.Location.Y);
            WalkingGuyTimer.Start();
            _pbWalkingGuy.Visible = true;

            if (PictureViewerForm == null)
            {
                PictureViewerForm = new PictureViewerForm();
            }
            PictureViewerForm.Show();
        }
Ejemplo n.º 6
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();
                }
            }
        }