private void addPlaylist_Click(object sender, EventArgs e)
        {
            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
                    {
                        foreach (string s in theReader.FilePaths)
                        {
                            PlayerForm.AddQueue(s);
                        }
                        listBox1.Items.Clear();
                        PopulateList();
                    }
                    catch (System.IO.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();
                    }
                }
            }
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
 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();
                 }
             }
         }
     }
 }
Пример #4
0
 private void LibraryQueueButton(ListBox listBox, List <string> list)
 {
     foreach (int selectedItem in listBox.SelectedIndices)
     {
         PlayerForm.AddQueue(list[selectedItem]);
     }
     listBox.ClearSelected();
 }
        private void addSong_Click(object sender, EventArgs e)
        {
            using (var selectFileDialog = new OpenFileDialog())

            {
                if (selectFileDialog.ShowDialog() == DialogResult.OK)
                {
                    PlayerForm.AddQueue(selectFileDialog.FileName);
                    listBox1.Items.Clear();
                    PopulateList();
                }
            }
        }
Пример #6
0
 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();
         }
     }
 }