Exemple #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (listView1.Items.Count != 0 && CommonInterface.CurrentTrackNumber >= 0)
     {
         if (!Audio.Random && CommonInterface.CurrentTrackNumber < CommonInterface.Files.Count - 1)
         {
             while (CommonInterface.CurrentTrackNumber < CommonInterface.Files.Count - 1)
             {
                 CommonInterface.CurrentTrackNumber++;
                 if (Audio.Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Audio.Volume))
                 {
                     CommonInterface.RefreshForm(CommonInterface.CurrentTrackNumber);
                     return;
                 }
                 else
                 {
                     CommonInterface.DeleteTrack(CommonInterface.CurrentTrackNumber);
                     CommonInterface.CurrentTrackNumber--;
                 }
             }
             if (Audio.Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Audio.Volume))
             {
                 CommonInterface.RefreshForm(CommonInterface.CurrentTrackNumber);
             }
         }
         else if (Audio.Random)
         {
             CommonInterface.RandomTrack();
         }
     }
 }
Exemple #2
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (listView1.Items.Count != 0 && listView1.SelectedItems.Count != 0)
     {
         if (listView1.SelectedItems[0].Index == CommonInterface.CurrentTrackNumber)
         {
             CommonInterface.ClearForm();
             CommonInterface.CurrentTrackNumber = -1;
         }
         else if (listView1.SelectedItems[0].Index < CommonInterface.CurrentTrackNumber)
         {
             CommonInterface.CurrentTrackNumber--;
         }
         CommonInterface.DeleteTrack(listView1.SelectedItems[0].Index);
     }
 }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.Items.Count != 0)
     {
         CommonInterface.ClearForm();
         while (CommonInterface.Files.Count > 0)
         {
             CommonInterface.CurrentTrackNumber = CommonInterface.Files.Count - 1;
             if (Audio.Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Audio.Volume))
             {
                 CommonInterface.RefreshForm(CommonInterface.CurrentTrackNumber);
                 return;
             }
             else
             {
                 CommonInterface.DeleteTrack(CommonInterface.CurrentTrackNumber);
             }
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// Переход к следующему треку
 /// </summary>
 /// <returns></returns>
 public static bool ToNextTrack()
 {
     if ((Bass.BASS_ChannelIsActive(Stream) == BASSActive.BASS_ACTIVE_STOPPED) && !isStoped)
     {
         if (CommonInterface.Files.Count > CommonInterface.CurrentTrackNumber + 1)
         {
             EndPlaylist = false;
             if (Repeat)
             {
                 if (Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Volume))
                 {
                     return(true);
                 }
                 return(false);
             }
             else if (Random)
             {
                 Random rand = new Random();
                 while (CommonInterface.Files.Count > 0)
                 {
                     CommonInterface.CurrentTrackNumber = rand.Next(CommonInterface.Files.Count);
                     if (Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Volume))
                     {
                         return(true);
                     }
                     else
                     {
                         CommonInterface.DeleteTrack(CommonInterface.CurrentTrackNumber);
                     }
                 }
                 return(false);
             }
             else
             {
                 while (CommonInterface.CurrentTrackNumber + 1 < CommonInterface.Files.Count)
                 {
                     if (Play(CommonInterface.Files[++CommonInterface.CurrentTrackNumber].Path, Volume))
                     {
                         return(true);
                     }
                     else
                     {
                         CommonInterface.DeleteTrack(CommonInterface.CurrentTrackNumber);
                         CommonInterface.CurrentTrackNumber--;
                     }
                 }
                 return(false);
             }
         }
         else
         {
             if (Repeat)
             {
                 if (Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Volume))
                 {
                     EndPlaylist = false;
                     return(true);
                 }
                 else
                 {
                     EndPlaylist = true;
                     return(false);
                 }
             }
             else if (Random)
             {
                 Random rand = new Random();
                 while (CommonInterface.Files.Count > 0)
                 {
                     CommonInterface.CurrentTrackNumber = rand.Next(CommonInterface.Files.Count);
                     if (Play(CommonInterface.Files[CommonInterface.CurrentTrackNumber].Path, Volume))
                     {
                         EndPlaylist = false;
                         return(true);
                     }
                     else
                     {
                         CommonInterface.DeleteTrack(CommonInterface.CurrentTrackNumber);
                     }
                 }
                 EndPlaylist = true;
                 return(false);
             }
             else
             {
                 EndPlaylist = true;
                 return(false);
             }
         }
     }
     return(false);
 }