Exemple #1
0
        public PlaylistEditorForm(Playlist playlist, MainForm mainForm)
        {
            InitializeComponent();
            this.FormClosing += PlaylistEditor_Closing;

            this._playlist = playlist;
            this._mainForm = mainForm;

            _currentPlaylistName = playlist.Name;

            _playlistName.Text = playlist.Name;

            _playlistSaver.Visible = true;
            _playlistSaver.Enabled = true;

            _playlistCreator.Visible = false;
            _playlistCreator.Enabled = false;

            _playlistDeleter.Visible = true;
            _playlistDeleter.Enabled = true;

            _filesInPlaylist.Items.AddRange(playlist.GetSongsKeys());

            _refreshingFolders.Items.AddRange(_playlist.GetRefreshingFolders());
        }
Exemple #2
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());
            }
        }
Exemple #3
0
        public PlaylistEditor(Playlist playlist, MainForm mainForm)
        {
            InitializeComponent();
            this.FormClosing += PlaylistEditor_FormClosing;

            this.playlist = playlist;
            this.mainForm = mainForm;

            currentPlaylistName = playlist.Name;

            textBox2.Text = currentPlaylistName;

            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(playlist.GetSongsKeys());

            checkBox1.Checked = playlist.AutomaticallyAddSongsFromFolders;
        }
Exemple #4
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());
            }
        }
Exemple #5
0
        public static void DeleteSongsFromFolder(FolderBrowserDialog folderBrowserDialog, ComboBox comboBox, Playlist playlist)
        {
            DialogResult dialogResult = folderBrowserDialog.ShowDialog();

            if (dialogResult != DialogResult.Cancel)
            {
                foreach (string path in Directory.GetFiles(folderBrowserDialog.SelectedPath))
                {
                    if (MainForm.AudioExtensions.Contains(Path.GetExtension(path)))
                    {
                        playlist.TryDeleteSongByPath(path);
                    }
                }

                comboBox.Items.Clear();
                comboBox.Items.AddRange(playlist.GetSongsKeys());
            }
        }
Exemple #6
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());
            }
        }
Exemple #7
0
 public static void DeleteSongComboBox(ComboBox comboBox, Playlist playlist)
 {
     playlist.TryDeleteSongByKey(comboBox.Items[comboBox.SelectedIndex] as string);
     comboBox.Items.Clear();
     comboBox.Items.AddRange(playlist.GetSongsKeys());
 }