예제 #1
0
        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());
            }
        }
예제 #2
0
        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());
            }
        }
예제 #3
0
        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());
            }
        }