예제 #1
0
파일: PlayerForm.cs 프로젝트: mkranz/Rejive
        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));
                }
            }
        }
예제 #2
0
파일: PlayerForm.cs 프로젝트: mkranz/Rejive
        /// <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);
                }
            }
        }