private void PlayButton_Click(object sender, RoutedEventArgs e) { if (_mp3 != null) _mp3.Stop(); _mp3 = PlaylistListBox.SelectedItem as Mp3File; if (_mp3 == null) return; PlayTrack(); }
private void OpenFolderButton_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog folderDialog = new FolderBrowserDialog(); if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string[] filenames = Directory.GetFiles(folderDialog.SelectedPath, "*.mp3"); foreach (string filename in filenames) { Mp3File newMp3 = new Mp3File(filename); _mp3List.Add(newMp3); } PlaylistListBox.ItemsSource = _mp3List; } }
private void _mp3_Stopped(object sender, StopEventArgs e) { if (e.StopCase != StopEventArgs.StopCases.Finished) return; Mp3File nextFile = _mp3List.ElementAtOrDefault(_mp3List.IndexOf(_mp3) + 1); if (nextFile != null) { _mp3 = nextFile; PlaylistListBox.SelectedItem = _mp3; PlayTrack(); } }