コード例 #1
0
ファイル: DragandPlay.cs プロジェクト: makakiyoAnju/MusicBot
        private void GetYoutube_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            YoutubeMusic NextSong = new YoutubeMusic(YoutubeBox.Text); //create a new song to hold the data and allow us to play it

            if (CurrentSong != null)                                   //if there is a current song to stop
            {
                MusicPlayer.Stop();                                    //stop the currently playing song
            }
            CurrentSong = NextSong;
            SongPlayer.RunWorkerAsync(); //run the song playing worker
        }
コード例 #2
0
 private void DragBox_DragDrop(object sender, DragEventArgs e)
 {
     string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); //get a list of files which the user has dropped
     if (FileList.Length > 1)                                                   //if the user is trying to ram more in then we can take
     {
         MessageBox.Show("One at a time, please!");                             //display a message telling the user to only drop one file at a time
     }
     SongToPlay          = new Song();
     SongToPlay.FilePath = FileList.First();
     SongPlayer.RunWorkerAsync();
     MessageBox.Show($"Will now attempt to play {FileList.First()}");
 }
コード例 #3
0
ファイル: DragandPlay.cs プロジェクト: makakiyoAnju/MusicBot
 private void DragBox_DragDrop(object sender, DragEventArgs e)                  //when something is dropped onto the DragBox
 {
     string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); //get a list of files which the user has dropped
     if (FileList.Length > 1)                                                   //if the user is trying to ram more in then we can take
     {
         MessageBox.Show("One at a time, please!");                             //display a message telling the user to only drop one file at a time
     }
     CurrentSong          = new Music();                                        //create a new song to hold the data and allow us to play it
     CurrentSong.FilePath = FileList.First();                                   //set the file path to the path of the dragged in file
     SongPlayer.RunWorkerAsync();                                               //run the song playing worker
     MessageBox.Show($"Will now attempt to play {FileList.First()}");
 }