/// <summary> /// 下一曲 /// </summary> private void NextMusic() { List <MusicItemViewModel> selectedItem = MusicList.Where(i => i.IsSelected == true).ToList(); if (selectedItem.Count > 0) { Playing = selectedItem.First(); int index = MusicList.IndexOf(Playing); if (PlayOrder == 0) { if (index < MusicList.Count - 1) { Playing.IsSelected = false; Playing = MusicList[++index]; Playing.IsSelected = true; //System.Threading.Thread.Sleep(100); PlayMusic(Playing.Music); } else { Playing.IsSelected = false; Playing = MusicList.First(); Playing.IsSelected = true; //System.Threading.Thread.Sleep(100); PlayMusic(Playing.Music); } } else if (PlayOrder == 1) { Random random = new Random(); int select; do { select = random.Next(MusicList.Count); } while (select == index); Playing.IsSelected = false; Playing = MusicList[select]; playing.IsSelected = true; PlayMusic(Playing.Music); } PlayIcon = new BitmapImage(new Uri("/Image/full_pause.png", UriKind.Relative)); } }