public void OnButtonNextClick() { outputDevice?.Pause(); outputDevice?.Stop(); DisposeOfSong(); audioFile = null; isPlaying = false; mainWindow.Song.Content = ""; mainWindow.Artist.Content = ""; if (_CurrentSong != null) { MusicQueue.AddSongToPreviousQueue(_CurrentSong); if (MusicQueue.isRepeat == true) { MusicQueue.songQueue.Clear(); MusicQueue.recommendedSongQueue.Clear(); MusicQueue.AddSongToQueue(_CurrentSong); this.PlayChosenSong(); } } if (MusicQueue.songQueue.Count != 0 && audioFile == null) { this.PlayChosenSong(); } else if (MusicQueue.recommendedSongQueue.Count != 0 && audioFile == null) { this.PlayChosenSong(); } }
//stop button, executes stop function(OnPlayBackStopped). public void OnButtonStopClick() { outputDevice?.Pause(); outputDevice?.Stop(); DisposeOfSong(); audioFile = null; isPlaying = false; if (_CurrentSong != null) { MusicQueue.AddSongToPreviousQueue(_CurrentSong); } }
//stop function, disposes of AudiofileReader. public void OnPlaybackStopped(object sender, StoppedEventArgs args) { if (this.CurrentPlaceInSongPercentage() >= 99) { outputDevice?.Pause(); outputDevice?.Stop(); MusicQueue.AddSongToPreviousQueue(_CurrentSong); PlayChosenSong(); } if (_CurrentSong == null) { } }