private async void BrowsePlaylist() { using (OpenFileDialog selectFileDialog = new OpenFileDialog()) { selectFileDialog.Filter = "Playlist Files|*.xspf;*.asx;*.wax;*.wvx;*.b4s;*.m3u;*.m3u8;*.pls;*.smil;*.smi;*.zpl;"; { if (selectFileDialog.ShowDialog() == DialogResult.OK) { IPlaylistIO theReader = PlaylistIOFactory.GetInstance().GetPlaylistIO(selectFileDialog.FileName); try { if (AddTrackCheckBox.Checked) { DatabaseHandler.ImportSong(theReader.FilePaths); } foreach (string s in theReader.FilePaths) { PlayerForm.AddQueue(s); } LibraryNeedsUpdating = true; PlayerForm.PlayMusic(); await UpdateLibrary(); } catch (DirectoryNotFoundException) { MessageBox.Show("This playlist file cannot be played because one or more of the songs could not be found.", "Songs not found", MessageBoxButtons.OK, MessageBoxIcon.Information); PlayerForm.ClearQueue(); } } } } }
private async void UserInterface_DragDrop(object sender, DragEventArgs e) { if (!TaskIsRunning) { await Task.Run(() => { TaskIsRunning = true; string[] tracks = (string[])e.Data.GetData(DataFormats.FileDrop); PlayerForm.AddQueue(tracks); if (AddTrackCheckBox.Checked && (e.KeyState & 8) != 8 /*CTRL key*/) { DatabaseHandler.ImportSong(tracks); } }); TaskIsRunning = false; LibraryNeedsUpdating = true; if ((e.KeyState & 4) != 4 /*SHIFT key*/) { PlayerForm.PlayMusic(); } await UpdateLibrary(); } }
private void LibraryPlayButton(ListBox listBox, List <string> list) { foreach (int selectedItem in listBox.SelectedIndices) { PlayerForm.AddQueue(list[selectedItem]); } PlayerForm.PlayMusic(); listBox.ClearSelected(); }
private async void BrowseMusic() { using (var selectFileDialog = new OpenFileDialog()) { selectFileDialog.Filter = "Audio Files|*.wav;*.aiff;*.mp3;*.wma;*.3g2;*.3gp;*.3gp2;*.3gpp;*.asf;*.wmv;*.aac;*.adts;*.avi;*.m4a;*.m4a;*.m4v;*.mov;*.mp4;*.sami;*.smi;*.flac|Other|*"; if (selectFileDialog.ShowDialog() == DialogResult.OK) { PlayerForm.AddQueue(selectFileDialog.FileName); PlayerForm.PlayMusic(); if (AddTrackCheckBox.Checked) { DatabaseHandler.ImportSong(selectFileDialog.FileNames); } LibraryNeedsUpdating = true; await UpdateLibrary(); } } }
private void toolStripMenuItem1_Click(object sender, EventArgs e) { PlayerForm.QueuePosition = listBox1.SelectedIndex; PlayerForm.PlayMusic(); }