/// <summary> /// 更换当前播放的音乐 /// </summary> void ChangeCurrentSong() { PlayList pl = null; PlayerState ps = GetPlayerState(); while (_playListSongs.Count == 0) { pl = PlayList.GetPlayList(ps, "p"); if (pl.Count == 0) { TakeABreak(); } else { ChangePlayListSongs(pl); break; } } lock (_playListSongs) Dispatcher.Invoke(new Action(() => { CurrentSong = _playListSongs.Dequeue(); })); }
void Report(string type, bool changeCurrentSong = true) { ThreadPool.QueueUserWorkItem(new WaitCallback((state) => { lock (workLock) { if (type == "s") { _skipping = true; } if (type == "b") { _neverring = true; } PlayList pl = null; PlayerState ps = GetPlayerState(); while (true) { pl = PlayList.GetPlayList(ps, type); if ((type == "p" || type == "n") && pl.Count == 0) { TakeABreak(); } else if (type == "e") { break; } else if (ps.CurrentChannel.IsDj) { break; } else if (pl.Count == 0) { TakeABreak(); } else { break; } } PlayerState ps2 = GetPlayerState(); if (ps.CurrentChannel == ps2.CurrentChannel) { if (pl.Count > 0) { ChangePlayListSongs(pl); } if (changeCurrentSong) { ChangeCurrentSong(); } } if (type == "s") { _skipping = false; } if (type == "b") { _neverring = false; } } })); }