private void cmdEnqueue_Click(object sender, EventArgs e) { using (FolderBrowserDialog dialog = new FolderBrowserDialog() { Description = "Select folder to add to playlist. Files will be added recursively.", SelectedPath = string.IsNullOrEmpty(Session.Profile.LastFolderOpened) ? Environment.GetFolderPath(Environment.SpecialFolder.MyMusic) : Session.Profile.LastFolderOpened, ShowNewFolderButton = false }) { DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { Session.Profile.LastFolderOpened = dialog.SelectedPath; Session.AddFilesToPlaylist(FileSearcher.GetAllFilesInDirectoryAndSubdirectories(dialog.SelectedPath)); } } }
/// <summary> /// Handle files drag and dropped from the file system /// </summary> private void Form_DragDrop(object sender, DragEventArgs e) { var dropResults = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string s in dropResults) { //handle dropping directories if (File.GetAttributes(s).HasFlag(FileAttributes.Directory)) { Session.AddFilesToPlaylist(FileSearcher.GetAllFilesInDirectoryAndSubdirectories(s)); } else { // it's a file Session.AddFileToPlayList(s); } } }