private void AddFile_Click(object sender, EventArgs e) { DialogResult dialogResult = _chooseMusicFile.ShowDialog(); if (dialogResult != DialogResult.Cancel) { foreach (string path in _chooseMusicFile.FileNames) { if (MainForm.AudioExtensions.Contains(Path.GetExtension(path))) { _playlist.AddSong(path); } } _filesInPlaylist.Items.Clear(); _filesInPlaylist.Items.AddRange(_playlist.GetSongsKeys()); } }
public static void ChooseMusicFile(OpenFileDialog openFileDialog, ComboBox comboBox, Playlist playlist) { DialogResult dialogResult = openFileDialog.ShowDialog(); if (dialogResult != DialogResult.Cancel) { foreach (string path in openFileDialog.FileNames) { if (MainForm.AudioExtensions.Contains(Path.GetExtension(path))) { playlist.AddSong(path); } } comboBox.Items.Clear(); comboBox.Items.AddRange(playlist.GetSongsKeys()); } }
public static void ChooseMusicFolder(FolderBrowserDialog folderBrowserDialog, ComboBox comboBox, Playlist playlist, bool updateFolders) { DialogResult dialogResult = folderBrowserDialog.ShowDialog(); if (dialogResult != DialogResult.Cancel) { foreach (string path in Directory.GetFiles(folderBrowserDialog.SelectedPath)) { if (MainForm.AudioExtensions.Contains(Path.GetExtension(path))) { playlist.AddSong(path, updateFolders); } } if (updateFolders) { playlist.SetFolderToUpdate(folderBrowserDialog.SelectedPath); } comboBox.Items.Clear(); comboBox.Items.AddRange(playlist.GetSongsKeys()); } }