Esempio n. 1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (MediaControl.Status() == "playing")
     {
         MediaControl.Pause();
     }
     else if (MediaControl.Status() == "paused")
     {
         MediaControl.Resume();
     }
     else if (MediaControl.Status() == "stopped")
     {
         MediaControl.Close();
         PlayMusic(curFileFullPath, true);
     }
     else
     {
         if (curIndex >= 0)
         {
             PlayMusic(curFileFullPath, true);
         }
         else
         {
             MediaControl.Close();
         }
     }
 }
Esempio n. 2
0
        private void PlayMusic(string musicFile, bool loop, int seekTime)
        {
            if (MediaControl.Status() == "playing" || MediaControl.Status() == "paused")
            {
                MediaControl.Close();
            }

            MediaControl.Open(musicFile);
            trackBar1.Maximum = MediaControl.Length();

            MediaControl.Play(loop, seekTime);

            PrintMusicName();
        }
Esempio n. 3
0
        private void PlayMusic(bool loop)
        {
            MediaControl.Close();

            if (curMusicList.Count > 0 && playCount > 0)
            {
                int rand = new Random().Next(curMusicList.Count);

                curFileFullPath  = curMusicList[rand].FullName;
                curMediaFileName = curMusicList[rand].Name;

                MediaControl.Open(curFileFullPath);
                MediaControl.Play(loop);
                playCount--;

                button1.Text = curMediaFileName;
                label2.Text  = playCount.ToString();
            }
        }