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(); } }
private void AddToQueueClick(object sender, RoutedEventArgs e) { var SongItem = sender as MenuItem; Song song = (Song)SongItem.Tag; MusicQueue.AddSongToQueue(song); }
private void PlayPlaylist(object sender, RoutedEventArgs e) { MusicQueue.songQueue.Clear(); MusicQueue.AddPlaylistToQueue(playlist); if (MusicQueue.isShuffle == true) { MusicQueue.ShuffleSongs(); } mainWindow.audioPlayer.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) { } }
private void ShuffleButtonClick(object sender, RoutedEventArgs e) { if (MusicQueue.isShuffle == false) { btnShuffle.Background = new SolidColorBrush(System.Windows.Media.Colors.DarkOrange); PackIconShuffle.Kind = MaterialDesignThemes.Wpf.PackIconKind.ShuffleVariant; MusicQueue.ShuffleSongs(); MusicQueue.isShuffle = true; } else { btnShuffle.Background = new SolidColorBrush(System.Windows.Media.Colors.DimGray); PackIconShuffle.Kind = MaterialDesignThemes.Wpf.PackIconKind.ShuffleDisabled; MusicQueue.isShuffle = false; } }
public void AddPlaylistSongToQueue(Song song) { MusicQueue.AddSongToQueue(song); }