| | |
| | | { |
| | | Tag = "MusicMain"; |
| | | } |
| | | public override void RemoveFromParent() |
| | | { |
| | | base.RemoveFromParent(); |
| | | clearA31Threads(); |
| | | } |
| | | static List<System.Threading.Thread> threadLists = new List<System.Threading.Thread>(); |
| | | //public override void RemoveFromParent() |
| | | //{ |
| | | // base.RemoveFromParent(); |
| | | // clearA31Threads(); |
| | | //} |
| | | |
| | | static void clearA31Threads() |
| | | { |
| | | var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; }); |
| | | foreach (var thread in threads) |
| | | { |
| | | try |
| | | { |
| | | threadLists.Remove(thread); |
| | | if (thread.IsAlive) |
| | | { |
| | | thread.Abort(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | System.Console.WriteLine(e.Message); |
| | | } |
| | | } |
| | | } |
| | | //static void clearA31Threads() |
| | | //{ |
| | | // var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; }); |
| | | // foreach (var thread in threads) |
| | | // { |
| | | // try |
| | | // { |
| | | // threadLists.Remove(thread); |
| | | // if (thread.IsAlive) |
| | | // { |
| | | // thread.Abort(); |
| | | // } |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // MainPage.Log("clearA31Threads error : " +e.Message); |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | |
| | | /// <summary> |
| | | /// 显示加载界面 |
| | | /// </summary> |
| | |
| | | } |
| | | else |
| | | { |
| | | clearA31Threads(); |
| | | //clearA31Threads(); |
| | | //verticalRefresh.RemoveAll(); |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | |
| | | a31MusicModel.IsOnLine = true; |
| | | } |
| | | } |
| | | catch (Exception e) { System.Console.WriteLine(e.Message); } |
| | | catch (Exception e) { MainPage.Log(e.Message); } |
| | | }); |
| | | } |
| | | } |
| | |
| | | a31player.IsEnd = false; |
| | | } |
| | | MusicListView(a31player); |
| | | A31MusicModel.ReadMusicStates(); |
| | | } |
| | | |
| | | }); |
| | | return; |
| | | } |
| | |
| | | //不是我们支持的品牌不支持 |
| | | if (obj.Name != null) |
| | | { |
| | | obj.sid = "00010112345678901234561A1A230123AABB" + obj.UniqueDeviceName; |
| | | A31MusicModel.A31MusicModelList.Add(obj); |
| | | } |
| | | } |
| | |
| | | musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; |
| | | musicView.songNameBtn.Text = a31player.A31PlayStatus.Title; |
| | | musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player); |
| | | musicView.regionBtn.TextID = StringId.region; |
| | | |
| | | if (a31player.IsEnd) |
| | | { |
| | | musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12); |
| | | } |
| | | |
| | | musicView.collectIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected; |
| | | if (a31player.ServerClientType == 1) |
| | | { |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | { |
| | | a31player.MainPlayCollection = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.MainPlayCollection = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | { |
| | | a31player.collection = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.collection = false; |
| | | } |
| | | } |
| | | A31MusicModel.Save(); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> clickMergence = (sender, e) => |
| | | { |
| | | if (a31player.ServerClientType == 0) |
| | |
| | | else if (a31player.ServerClientType == 1) |
| | | { |
| | | new View.DialogView { }.DetachPlayMergence(a31player); |
| | | |
| | | } |
| | | }; |
| | | musicView.mergeBjBtn.MouseUpEventHandler += clickMergence; |
| | | musicView.mergeBtn.MouseUpEventHandler += clickMergence; |
| | | musicView.mergeIconBtn.MouseUpEventHandler += clickMergence; |
| | | |
| | | musicView.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | EventHandler<MouseEventArgs> clickPlayView = (sender, e) => |
| | | { |
| | | A31MusicModel.Current = a31player;//当前播放器 |
| | | var a31PlayMusicPage = new A31PlayMusicPage(); |
| | |
| | | a31PlayMusicPage.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | musicView.musicIfonFl.MouseUpEventHandler += clickPlayView; |
| | | musicView.clickBtn.MouseUpEventHandler += clickPlayView;// |
| | | |
| | | ///上一曲点击事件 |
| | | musicView.prevBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | |
| | | musicView.nextBtn.IsSelected = false; |
| | | }; |
| | | |
| | | musicView.collectIconBtn.MouseUpEventHandler = (sender, e) => |
| | | var musicThread = new System.Threading.Thread(() => |
| | | { |
| | | musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected; |
| | | a31player.collection = musicView.collectIconBtn.IsSelected ? true : false; |
| | | }; |
| | | |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | System.Threading.Thread.CurrentThread.Name = "A31"; |
| | | threadLists.Add(System.Threading.Thread.CurrentThread); |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | |
| | | { |
| | | continue; |
| | | } |
| | | SendMethod.ReadStatus(a31player); |
| | | //SendMethod.ReadStatus(a31player); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; |
| | |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | } |
| | | }); |
| | | musicView.regionBtn.Text = a31player.GetRoomListName(); |
| | | if (a31player.ServerClientType == 1) |
| | | { |
| | | if (a31player.MainPlayCollection) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (a31player.collection) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true, Name = "A31" }; |
| | | musicThread.Start(); |
| | | //threadLists.Add(musicThread); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取主从关系 |
| | |
| | | string str = a31player.Name; |
| | | for (int j = 0; j < a31player.Slave.slave_list.Count; j++) |
| | | { |
| | | |
| | | var slave = a31player.Slave.slave_list[j]; |
| | | str = str + "+" + slave.name; |
| | | var tempA31Player = A31MusicModel.A31MusicModelList.Find((obj) => slave.uuid.Replace("uuid:", "") == obj.UniqueDeviceName); |
| | |
| | | { |
| | | A31MusicModel.A31MusicModelList.Add(new A31MusicModel |
| | | { |
| | | sid = "00010112345678901234561A1A230123AABB" + slave.uuid.Replace("uuid:", ""), |
| | | ServerClientType = -1,//从的 |
| | | IPAddress = slave.ip, |
| | | MainPlayIP = a31player.IPAddress, |
| | |
| | | tempA31Player.UniqueDeviceName = slave.uuid.Replace("uuid:", ""); |
| | | tempA31Player.IsCanShow = false; |
| | | tempA31Player.IsOnLine = false;//true作用为了读取从播放器的音量 |
| | | |
| | | } |
| | | } |
| | | a31player.MainPlayName = str; |
| | |
| | | var ss = e.Message; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |