protected override void Run(Cmd cmd) { if (Mp.CurrentTrack == null) { Clti.WriteLine("No track is currently playing"); return; } Mp.Pause(); Clti.WriteLine("Paused"); }
void Play(object o) { Random rand = new Random(); if (IsShuffled == true && o == null && flag == 0) { int n = rand.Next(0, Songs.Count); int temprand = n; if (CurrentSong == Songs[n]) { while (temprand == n) { n = rand.Next(0, Songs.Count); } } CurrentSong = Songs[n]; Mp.Open(new Uri(Songs[n].PathS, UriKind.RelativeOrAbsolute)); Mp.Play(); Mp.MediaOpened += new EventHandler(mediaOpened); flag = 1; } else if ((o != null && (flag == 0)) || (o != temp && (flag == 2 || flag == 1)) && IsShuffled == true) { int n = rand.Next(0, Songs.Count); int temprand = n; if (CurrentSong == Songs[n]) { while (temprand == n) { n = rand.Next(0, Songs.Count); } } CurrentSong = Songs[n]; Mp.Open(new Uri(Songs[n].PathS, UriKind.RelativeOrAbsolute)); Mp.Play(); Mp.MediaOpened += new EventHandler(mediaOpened); Isplaying = true; flag = 1; } else if ((o != null && (flag == 0)) || (o != temp && (flag == 2 || flag == 1)) && IsShuffled == false) { Song s = o as Song; CurrentSong = s; Mp.Open(new Uri(s.PathS, UriKind.RelativeOrAbsolute)); Mp.Play(); Mp.MediaOpened += new EventHandler(mediaOpened); Isplaying = true; flag = 1; } else if (o == null && flag == 0 && IsShuffled == false) { Mp.Open(new Uri(Songs[0].PathS, UriKind.RelativeOrAbsolute)); CurrentSong = Songs[0]; Mp.Play(); Mp.MediaOpened += new EventHandler(mediaOpened); flag = 1; } else if (flag == 1) { Mp.Pause(); flag = 2; } else if (flag == 2) { Mp.Play(); flag = 1; } Selecteds = CurrentSong; temp = Selecteds; }