Beispiel #1
0
        public void PlayAndPauseAndPlay()
        {
            var songPlayer = new SongPlayer(MP3MattRedman, GtTimeSignature.Time4x4);

            try
            {
                songPlayer.Play();
                Thread.Sleep(100);

                songPlayer.Pause();
                var currentPosition = songPlayer.CurrentPosition;

                Thread.Sleep(100);

                Assert.AreEqual(SongPlayerStatus.Paused, songPlayer.Status);

                //Is really paused
                Assert.AreEqual(currentPosition, songPlayer.CurrentPosition);

                //start again from the paused point
                songPlayer.Play();
                Thread.Sleep(100);

                Assert.AreEqual(SongPlayerStatus.Playing, songPlayer.Status);
                Assert.Greater(songPlayer.CurrentPosition, currentPosition);
            }
            finally
            {
                songPlayer.Dispose();
            }
        }
Beispiel #2
0
 void Pause(object sender, EventArgs e)
 {
     SongPlayer.Pause(); // Change state
     if (SongPlayer.State != PlayerState.Paused)
     {
         stopButton.Enabled = true;
         pauseButton.Text   = "Pause";
         timer.Start();
     }
     else
     {
         stopButton.Enabled = false;
         pauseButton.Text   = "Unpause";
         timer.Stop();
         System.Threading.Monitor.Enter(timerLock);
         ClearPianoNotes();
     }
     UpdateTaskbarState();
 }
Beispiel #3
0
        public void PlayEmptyFileName()
        {
            using (ISongPlayer songPlayer = new SongPlayer(string.Empty, GtTimeSignature.Time4x4))
            {
                songPlayer.Play();
                Thread.Sleep(100);

                Assert.AreEqual(-1, songPlayer.CurrentPosition);

                songPlayer.Pause();
                Thread.Sleep(100);

                Assert.AreEqual(SongPlayerStatus.Paused, songPlayer.Status);

                //start again from the paused point
                songPlayer.Play();
                Thread.Sleep(100);

                Assert.AreEqual(SongPlayerStatus.Playing, songPlayer.Status);
                Assert.AreEqual(-1, songPlayer.CurrentPosition);
            }
        }
 public void Pause()
 {
     songPlayer.Pause();
     windowLeerling.panelPiano.Piano.ResetAll();
     //windowLeerling.tempoToolStripMenuItem.Enabled = true;
 }
 // (0.0.4)
 #region EndQuestion
 private void EndQuestion_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     SongPlayer.Pause();
     CurrentGameMode = GameMode.Talking;
 }