public void Stop()
 {
     songPlayer.Stop();
     windowLeerling.panelPiano.Piano.ResetAll();
     songProgress.Reset();
     windowLeerling.tempoToolStripMenuItem.Enabled = true;
 }
Exemple #2
0
        private void CoverImageGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (SongPlayer.CurrentState != MediaElementState.Playing)
            {
                return;
            }
            if (((Song)e.ClickedItem).Thumbnail.UriSource.AbsolutePath.Contains("Assets"))
            {
                return;
            }

            //  Judge the user selection,
            //  Show UI effects about result of the user selection
            //  Change the user scores
            if (CurrentSong.Equals((Song)e.ClickedItem))
            {
                CurrentSong.GameMark = true;
                _correctSongs.Add(CurrentSong);
                ((Song)e.ClickedItem).Thumbnail = new BitmapImage(new Uri("ms-appx:///Assets/correct.png"));
                _ttlScore += (int)CountDownBar.Value * 2;
            }
            else
            {
                ((Song)e.ClickedItem).Thumbnail = new BitmapImage(new Uri("ms-appx:///Assets/incorrect.png"));
                _ttlScore += (int)CountDownBar.Value * -2;
            }
            SongPlayer.Stop();
        }
Exemple #3
0
        private static void StopButton_Click(object sender, EventArgs e)
        {
            Form.Timer.Stop();
            Timer.Change(Timeout.Infinite, 10);

            SongPlayer.Stop();
            Midi.MidiPlayer.Stop();
        }
Exemple #4
0
 void Stop(object sender, EventArgs e)
 {
     SongPlayer.Stop();
     positionBar.Enabled = pauseButton.Enabled = stopButton.Enabled = false;
     timer.Stop();
     System.Threading.Monitor.Enter(timerLock);
     ClearPianoNotes();
     trackInfo.DeleteData();
     UpdateSongPosition(0);
     UpdateTaskbarState();
 }
Exemple #5
0
 private async void CountDownAnimation_Completed(object sender, object e)
 {
     if (_gameStatus == true)
     {
         await GameStarted();
     }
     else
     {
         _ttlScore -= 100;
         SongPlayer.Stop();
     }
 }
Exemple #6
0
        private static void Form_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
        {
            Form.PlayButton.Click -= PlayButton_Click;
            Form.StopButton.Click -= StopButton_Click;
            Form.FormClosed       -= Form_FormClosed;

            Form.Timer.Stop();
            Timer.Change(Timeout.Infinite, 10);

            SongPlayer.Stop();
            Midi.MidiPlayer.Stop();

            Form = null;
        }
Exemple #7
0
        public void Play()
        {
            var songPlayer = new SongPlayer(MP3MattRedman, GtTimeSignature.Time4x4);

            try
            {
                songPlayer.Play();
                Assert.AreEqual(SongPlayerStatus.Playing, songPlayer.Status);
            }
            finally
            {
                songPlayer.Stop();
                songPlayer.Dispose();
            }
        }
Exemple #8
0
        public void PlayAndStop()
        {
            var songPlayer = new SongPlayer(MP3MattRedman, GtTimeSignature.Time4x4);

            try
            {
                songPlayer.Play();
                Assert.AreEqual(SongPlayerStatus.Playing, songPlayer.Status);

                Thread.Sleep(100);

                songPlayer.Stop();
                Assert.AreEqual(SongPlayerStatus.Stopped, songPlayer.Status);
                Assert.AreEqual(0, songPlayer.CurrentPosition);
            }
            finally
            {
                songPlayer.Dispose();
            }
        }
        private void Select()
        {
            switch (selected)
            {
            case MMenuHighligh.Play:
                IsFinished = true;
                NewState   = new MainState("Content/Stages/TestStage.bin");
                break;

            case MMenuHighligh.Options:
                break;

            case MMenuHighligh.Exit:
                IsFinished = true;
                break;
            }
            if (selected != MMenuHighligh.Options)
            {
                songPlayer.Stop();
            }
        }
Exemple #10
0
        public void PlayAndStopAndPlay()
        {
            var songPlayer = new SongPlayer(MP3MattRedman, GtTimeSignature.Time4x4);

            try
            {
                songPlayer.Play();

                Thread.Sleep(100);
                var currentPosition = songPlayer.CurrentPosition;

                songPlayer.Stop();

                //start again from the beggining
                songPlayer.Play();

                Assert.AreEqual(SongPlayerStatus.Playing, songPlayer.Status);
                Assert.Less(songPlayer.CurrentPosition, currentPosition);
            }
            finally
            {
                songPlayer.Dispose();
            }
        }