コード例 #1
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();
                }
            }
        }
コード例 #2
0
        private void StartTimer()
        {
            Sequencer.Start();

            ResumeTimer();
        }
コード例 #3
0
 private void _btnShuffle_Click(object sender, EventArgs e)
 {
     Sequencer.Shuffle();
 }