|  |  | 
 |  |  | using Shared; | 
 |  |  | using Shared.IO; | 
 |  |  | using System.Net; | 
 |  |  | using HDL_ON.Entity; | 
 |  |  |  | 
 |  |  | namespace HDL_ON.UI.Music | 
 |  |  | { | 
 |  |  |     public class MusicMain : FrameLayout | 
 |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         ///  显示加载界面 | 
 |  |  |         /// </summary> | 
 |  |  |         public  static Loading loading = new Loading(); | 
 |  |  |         public static Loading loading = new Loading(); | 
 |  |  |         /// <summary> | 
 |  |  |         /// 定义全局对象 | 
 |  |  |         /// </summary> | 
 |  |  |         VerticalRefreshLayout verticalRefresh; | 
 |  |  |         /// <summary> | 
 |  |  |         /// 为了音乐刷新状态定义全局对象 | 
 |  |  |         /// </summary> | 
 |  |  |         MusicView musicView = new MusicView(); | 
 |  |  |         public void Show() | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             #region 界面布局 | 
 |  |  |             this.BackgroundColor = MusicColor.ViewColor; | 
 |  |  |             var topView = new TopView(); | 
 |  |  |             this.AddChidren(topView.TopFLayoutView()); | 
 |  |  |             topView.topNameBtn.TextID =StringId.a31Music; | 
 |  |  |             topView.topNameBtn.TextID = StringId.a31Music; | 
 |  |  |             topView.clickBackBtn.MouseUpEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 RemoveFromParent(); | 
 |  |  | 
 |  |  |  | 
 |  |  |             verticalRefresh.BeginHeaderRefreshingAction += () => | 
 |  |  |             { | 
 |  |  |                 SeachMusic(false); | 
 |  |  |  | 
 |  |  |                 SeachMusic(); | 
 |  |  |             }; | 
 |  |  |             this.AddChidren(loading); | 
 |  |  |             SeachMusic(); | 
 |  |  |  | 
 |  |  |             if (A31MusicModel.A31MusicModelList.Count == 0) | 
 |  |  |             { | 
 |  |  |                 SeachMusic(true); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 clearA31Threads(); | 
 |  |  |                //verticalRefresh.RemoveAll(); | 
 |  |  |                 for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     var a31player = A31MusicModel.A31MusicModelList[i]; | 
 |  |  |                     ///这个状态是之前保存的,加载完成后要标记为不在线,后面再读取正确的状态 | 
 |  |  |                     if (!a31player.IsCanShow) | 
 |  |  |                     { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     if (A31MusicModel.A31MusicModelList.Count - 1 == i) | 
 |  |  |                     { | 
 |  |  |                         a31player.IsEnd = true; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         a31player.IsEnd = false; | 
 |  |  |                     } | 
 |  |  |                     ///加载界面时默认不在线 | 
 |  |  |                     ///这里标记是为了不读取不在线播放器状态 | 
 |  |  |                     a31player.IsOnLine = false; | 
 |  |  |                     MusicListView(a31player); | 
 |  |  |                 } | 
 |  |  |                 ///读取正确的信息,包括IP和端口及名称 | 
 |  |  |                 SendMethod.Seach((obj) => | 
 |  |  |                 { | 
 |  |  |                     try | 
 |  |  |                     { | 
 |  |  |                         if (obj == null) | 
 |  |  |                         { | 
 |  |  |                             ///这里要读取主从关系 | 
 |  |  |                             readServerOrClientMode(); | 
 |  |  |                             A31MusicModel.Save(); | 
 |  |  |                             return; | 
 |  |  |                         } | 
 |  |  |                         var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => music.UniqueDeviceName == obj.UniqueDeviceName); | 
 |  |  |                         if (a31MusicModel != null) | 
 |  |  |                         { | 
 |  |  |                             a31MusicModel.IPAddress = obj.IPAddress; | 
 |  |  |                             a31MusicModel.Port = obj.Port; | 
 |  |  |                             a31MusicModel.Name = obj.Name; | 
 |  |  |                             a31MusicModel.IsCanShow = true; | 
 |  |  |                             a31MusicModel.IsOnLine = true; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     catch (Exception e) { MainPage.Log(e.Message); } | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// 刷新播放器列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="Yes">是否显示刷新图标</param> | 
 |  |  |         void SeachMusic(bool Yes = false) | 
 |  |  |         void SeachMusic() | 
 |  |  |         { | 
 |  |  |             for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) | 
 |  |  |             Application.RunOnMainThread(() => | 
 |  |  |             { | 
 |  |  |                 var a31player = A31MusicModel.A31MusicModelList[i]; | 
 |  |  |                 a31player.IsCanShow = false; | 
 |  |  |                 a31player.IsOnLine = false; | 
 |  |  |             } | 
 |  |  |             if (Yes) | 
 |  |  |             { | 
 |  |  |                 //为了第一次进来log一下; | 
 |  |  |                 loading.Start(); | 
 |  |  |             } | 
 |  |  |             SendMethod.Seach((obj) => | 
 |  |  |             { | 
 |  |  |                 if (obj == null) | 
 |  |  |                 verticalRefresh.RemoveAll(); | 
 |  |  |                 for (int i = 0; i < SendMethod.sendMethod.GetMusicList.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     readServerOrClientMode(); | 
 |  |  |                     A31MusicModel.Save(); | 
 |  |  |                     if (!Yes) | 
 |  |  |                     var playerFunction = SendMethod.sendMethod.GetMusicList[i];  | 
 |  |  |                     if (!playerFunction.online) | 
 |  |  |                     { | 
 |  |  |                         ///等待跑完在关闭 | 
 |  |  |                         verticalRefresh.EndHeaderRefreshing(); | 
 |  |  |                         //过滤掉不在线的音乐播放器 | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     Application.RunOnMainThread(() => | 
 |  |  |                     { | 
 |  |  |                         if (Yes) | 
 |  |  |                         { | 
 |  |  |                             //为了第一次进来log一下; | 
 |  |  |                             loading.Hide(); | 
 |  |  |                         } | 
 |  |  |                         verticalRefresh.RemoveAll(); | 
 |  |  |                         for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) | 
 |  |  |                         { | 
 |  |  |                             var a31player = A31MusicModel.A31MusicModelList[i]; | 
 |  |  |                             //这个状态是之前保存的,加载完成后要标记为不在线,后面再读取正确的状态 | 
 |  |  |                             if (!a31player.IsCanShow) | 
 |  |  |                             { | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |                             if (A31MusicModel.A31MusicModelList.Count - 1 == i) | 
 |  |  |                             { | 
 |  |  |                                 a31player.IsEnd = true; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 a31player.IsEnd = false; | 
 |  |  |                             } | 
 |  |  |                             MusicListView(a31player); | 
 |  |  |                         } | 
 |  |  |                        //A31MusicModel.ReadMusicStates(); | 
 |  |  |                     MusicListView(playerFunction); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                     }); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => { return music.UniqueDeviceName == obj.UniqueDeviceName; }); | 
 |  |  |                 if (a31MusicModel == null) | 
 |  |  |                 { | 
 |  |  |                     //不是我们支持的品牌不支持 | 
 |  |  |                     if (obj.Name != null) | 
 |  |  |                     { | 
 |  |  |                         obj.sid = "030101123456780909020123AABB" + obj.UniqueDeviceName; | 
 |  |  |                         A31MusicModel.A31MusicModelList.Add(obj); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     a31MusicModel.IPAddress = obj.IPAddress; | 
 |  |  |                     a31MusicModel.Port = obj.Port; | 
 |  |  |                     a31MusicModel.Name = obj.Name; | 
 |  |  |                     a31MusicModel.IsCanShow = true; | 
 |  |  |                     a31MusicModel.IsOnLine = true; | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// 显示音乐列表的方法 | 
 |  |  |         /// </summary> | 
 |  |  |         void MusicListView(A31MusicModel a31player) | 
 |  |  |         void MusicListView(Function player)  | 
 |  |  |         { | 
 |  |  |             MusicView musicView = new MusicView(); | 
 |  |  |             musicView.View(verticalRefresh); | 
 |  |  |             musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; | 
 |  |  |             musicView.songNameBtn.Text = a31player.A31PlayStatus.Title; | 
 |  |  |             musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player); | 
 |  |  |             if (a31player.IsEnd) | 
 |  |  |             { | 
 |  |  |                 musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12); | 
 |  |  |             } | 
 |  |  |             musicView.singerBtn.Text = player.GetAttrState("song_name"); | 
 |  |  |             musicView.songNameBtn.Text = player.GetAttrState("song_name"); | 
 |  |  |             musicView.musicNameBtn.Text = player.name; | 
 |  |  |             //if (player.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) | 
 |  |  |                 { | 
 |  |  |                     if (musicView.collectIconBtn.IsSelected) | 
 |  |  |                     { | 
 |  |  |                         a31player.MainPlayCollection = true; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         a31player.MainPlayCollection = false; | 
 |  |  |                     } | 
 |  |  |                     player.collect = true; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     if (musicView.collectIconBtn.IsSelected) | 
 |  |  |                     { | 
 |  |  |                         a31player.collect = true; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         a31player.collect = false; | 
 |  |  |                     } | 
 |  |  |                     player.collect = false; | 
 |  |  |                 } | 
 |  |  |                 A31MusicModel.Save(); | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             EventHandler<MouseEventArgs> clickMergence = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 if (a31player.ServerClientType == 0) | 
 |  |  |                 { | 
 |  |  |                     new View.DialogView { }.PlayMergence(a31player); | 
 |  |  |                 } | 
 |  |  |                 else if (a31player.ServerClientType == 1) | 
 |  |  |                 { | 
 |  |  |                     new View.DialogView { }.DetachPlayMergence(a31player); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 //if (player.ServerClientType == 0) | 
 |  |  |                 //{ | 
 |  |  |                 //    new View.DialogView { }.PlayMergence(player); | 
 |  |  |                 //} | 
 |  |  |                 //else if (player.ServerClientType == 1) | 
 |  |  |                 //{ | 
 |  |  |                 //    new View.DialogView { }.DetachPlayMergence(player); | 
 |  |  |                 //} | 
 |  |  |             }; | 
 |  |  |             musicView.mergeBjBtn.MouseUpEventHandler += clickMergence; | 
 |  |  |             musicView.mergeBtn.MouseUpEventHandler += clickMergence; | 
 |  |  | 
 |  |  |  | 
 |  |  |             EventHandler<MouseEventArgs> clickPlayView = (sender, e) => | 
 |  |  |             { | 
 |  |  |                 A31MusicModel.Current = a31player;//当前播放器 | 
 |  |  |                 var a31PlayMusicPage = new A31PlayMusicPage(); | 
 |  |  |                 MainPage.BasePageView.AddChidren(a31PlayMusicPage); | 
 |  |  |                 a31PlayMusicPage.Show(); | 
 |  |  | 
 |  |  |             musicView.prevBtn.MouseDownEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 musicView.prevBtn.IsSelected = true; | 
 |  |  |                 SendMethod.Previous(a31player); | 
 |  |  |                 Dictionary<string, string> dic = new Dictionary<string, string>(); | 
 |  |  |                 dic.Add("song_step", "up"); | 
 |  |  |                 SendMethod.sendMethod.SendControlCommand(player, dic); | 
 |  |  |             }; | 
 |  |  |             musicView.prevBtn.MouseUpEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  | 
 |  |  |             ///暂停/播放点击事件 | 
 |  |  |             musicView.playBtn.MouseDownEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 string status = "off"; | 
 |  |  |                 if (musicView.playBtn.IsSelected) | 
 |  |  |                 { | 
 |  |  |                     musicView.playBtn.IsSelected = false; | 
 |  |  |                     SendMethod.Pause(a31player); | 
 |  |  |                     a31player.A31PlayStatus.status = "pause"; | 
 |  |  |                     status = "off"; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     musicView.playBtn.IsSelected = true; | 
 |  |  |                     SendMethod.Play(a31player); | 
 |  |  |                     a31player.A31PlayStatus.status = "play"; | 
 |  |  |                     status = "on"; | 
 |  |  |                 } | 
 |  |  |                 Dictionary<string, string> dic = new Dictionary<string, string>(); | 
 |  |  |                 dic.Add("on_off", status); | 
 |  |  |                 SendMethod.sendMethod.SendControlCommand(player, dic); | 
 |  |  |             }; | 
 |  |  |             ///下一曲点击事件 | 
 |  |  |             musicView.nextBtn.MouseDownEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  |                 musicView.nextBtn.IsSelected = true; | 
 |  |  |                 SendMethod.Next(a31player); | 
 |  |  |                 Dictionary<string, string> dic = new Dictionary<string, string>(); | 
 |  |  |                 dic.Add("song_step", "down"); | 
 |  |  |                 SendMethod.sendMethod.SendControlCommand(player, dic); | 
 |  |  |             }; | 
 |  |  |             musicView.nextBtn.MouseUpEventHandler += (sender, e) => | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 while (true) | 
 |  |  |                 { | 
 |  |  |                     System.Threading.Thread.Sleep(1000); | 
 |  |  |                     if (!a31player.IsOnLine) | 
 |  |  |                     if (!player.online) | 
 |  |  |                     { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     SendMethod.ReadStatus(a31player); | 
 |  |  |                     //SendMethod.ReadStatus(player); | 
 |  |  |                      SendMethod.sendMethod.RefreshDeviceStatus(player,new List<string> { player.deviceId }); | 
 |  |  |                   | 
 |  |  |                     Application.RunOnMainThread(() => | 
 |  |  |                     { | 
 |  |  |                         musicView.singerBtn.Text = a31player.A31PlayStatus.Artist; | 
 |  |  |                         musicView.songNameBtn.Text = a31player.A31PlayStatus.Title; | 
 |  |  |                         musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player); | 
 |  |  |                         if (a31player.A31PlayStatus.status == "play") | 
 |  |  |                         { | 
 |  |  |                             musicView.playBtn.IsSelected = true; | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             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.collect) | 
 |  |  |                             { | 
 |  |  |                                 musicView.collectIconBtn.IsSelected = true; | 
 |  |  |                             } | 
 |  |  |                             else | 
 |  |  |                             { | 
 |  |  |                                 musicView.collectIconBtn.IsSelected = false; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         //musicView.singerBtn.Text = player.A31PlayStatus.Artist; | 
 |  |  |                         //musicView.songNameBtn.Text = player.A31PlayStatus.Title; | 
 |  |  |                         //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player); | 
 |  |  |                         //if (player.A31PlayStatus.status == "play") | 
 |  |  |                         //{ | 
 |  |  |                         //    musicView.playBtn.IsSelected = true; | 
 |  |  |                         //} | 
 |  |  |                         //else | 
 |  |  |                         //{ | 
 |  |  |                         //    musicView.playBtn.IsSelected = false; | 
 |  |  |                         //} | 
 |  |  |                         //musicView.regionBtn.Text = player.GetRoomListName(); | 
 |  |  |                         //if (player.ServerClientType == 1) | 
 |  |  |                         //{ | 
 |  |  |                         //    if (player.MainPlayCollection) | 
 |  |  |                         //    { | 
 |  |  |                         //        musicView.collectIconBtn.IsSelected = true; | 
 |  |  |                         //    } | 
 |  |  |                         //    else | 
 |  |  |                         //    { | 
 |  |  |                         //        musicView.collectIconBtn.IsSelected = false; | 
 |  |  |                         //    } | 
 |  |  |                         //} | 
 |  |  |                         //else | 
 |  |  |                         //{ | 
 |  |  |                         //    if (player.collect) | 
 |  |  |                         //    { | 
 |  |  |                         //        musicView.collectIconBtn.IsSelected = true; | 
 |  |  |                         //    } | 
 |  |  |                         //    else | 
 |  |  |                         //    { | 
 |  |  |                         //        musicView.collectIconBtn.IsSelected = false; | 
 |  |  |                         //    } | 
 |  |  |                         //} | 
 |  |  |                     }); | 
 |  |  |                 } | 
 |  |  |             }) | 
 |  |  | 
 |  |  |             musicThread.Start(); | 
 |  |  |             threadLists.Add(musicThread); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 读取主从关系 | 
 |  |  |         ///指定刷新界面 | 
 |  |  |         /// </summary> | 
 |  |  |         void readServerOrClientMode() | 
 |  |  |         /// <param name="strView">判断字符</param> | 
 |  |  |         public void RefreshView(string strView) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             Application.RunOnMainThread(() => | 
 |  |  |             { | 
 |  |  |                 for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) | 
 |  |  |                 try | 
 |  |  |                 { | 
 |  |  |                     var a31player = A31MusicModel.A31MusicModelList[i]; | 
 |  |  |                     if (!a31player.IsOnLine) | 
 |  |  |                    | 
 |  |  |                     for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) | 
 |  |  |                     { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     try | 
 |  |  |                     { | 
 |  |  |                         a31player.ServerClientType = 0; | 
 |  |  |                         var result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); | 
 |  |  |                         if (result == null && result == "Failed") | 
 |  |  |                         var view = MainPage.BasePageView.GetChildren(i); | 
 |  |  |                         if (strView == view.Tag.ToString()) | 
 |  |  |                         { | 
 |  |  |                             result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList"); | 
 |  |  |                         } | 
 |  |  |                         if (result != null && result != "Failed") | 
 |  |  |                         { | 
 |  |  |                             a31player.Slave = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     catch (Exception e) | 
 |  |  |                     { | 
 |  |  |                         var d = e.Message; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //分析主从关系 | 
 |  |  |                 for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     var a31player = A31MusicModel.A31MusicModelList[i]; | 
 |  |  |                     if (!a31player.IsOnLine) | 
 |  |  |                     { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     try | 
 |  |  |                     { | 
 |  |  |                         if (a31player.Slave != null && "0" != a31player.Slave.slaves) | 
 |  |  |                         { | 
 |  |  |                             a31player.ServerClientType = 1;//主的 | 
 |  |  |                             string str = a31player.Name; | 
 |  |  |                             for (int j = 0; j < a31player.Slave.slave_list.Count; j++) | 
 |  |  |                             if (view.GetType() == typeof(MusicMain)) | 
 |  |  |                             { | 
 |  |  |  | 
 |  |  |                                 var slave = a31player.Slave.slave_list[j]; | 
 |  |  |                                 str = str + "+" + slave.name; | 
 |  |  |                                 var tempA31Player = A31MusicModel.A31MusicModelList.Find((obj) => slave.uuid.Replace("uuid:", "") == obj.UniqueDeviceName); | 
 |  |  |                                 if (tempA31Player == null) | 
 |  |  |                                 { | 
 |  |  |                                     A31MusicModel.A31MusicModelList.Add(new A31MusicModel | 
 |  |  |                                     { | 
 |  |  |                                         sid = "030101123456780909020123AABB" + slave.uuid.Replace("uuid:", ""), | 
 |  |  |                                         ServerClientType = -1,//从的 | 
 |  |  |                                         IPAddress = slave.ip, | 
 |  |  |                                         MainPlayIP = a31player.IPAddress, | 
 |  |  |                                         UniqueDeviceName = slave.uuid.Replace("uuid:", ""), | 
 |  |  |                                         Name = slave.name, | 
 |  |  |                                         IsCanShow = false, | 
 |  |  |                                         IsOnLine = false,//true作用为了读取从播放器的音量 | 
 |  |  |                                     }); | 
 |  |  |                                 } | 
 |  |  |                                 //如果找到就更新为从的 | 
 |  |  |                                 else | 
 |  |  |                                 { | 
 |  |  |                                     tempA31Player.ServerClientType = -1;//从的 | 
 |  |  |                                     tempA31Player.IPAddress = slave.ip; | 
 |  |  |                                     tempA31Player.MainPlayIP = a31player.IPAddress; | 
 |  |  |                                     tempA31Player.Name = slave.name; | 
 |  |  |                                     tempA31Player.UniqueDeviceName = slave.uuid.Replace("uuid:", ""); | 
 |  |  |                                     tempA31Player.IsCanShow = false; | 
 |  |  |                                     tempA31Player.IsOnLine = false;//true作用为了读取从播放器的音量 | 
 |  |  |  | 
 |  |  |                                 } | 
 |  |  |                                 //musicView.singerBtn.Text = player.A31PlayStatus.Artist; | 
 |  |  |                                 //musicView.songNameBtn.Text = player.A31PlayStatus.Title; | 
 |  |  |                                 //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player); | 
 |  |  |                                 //if (player.A31PlayStatus.status == "play") | 
 |  |  |                                 //{ | 
 |  |  |                                 //    musicView.playBtn.IsSelected = true; | 
 |  |  |                                 //} | 
 |  |  |                                 //else | 
 |  |  |                                 //{ | 
 |  |  |                                 //    musicView.playBtn.IsSelected = false; | 
 |  |  |                                 //} | 
 |  |  |                                 //musicView.regionBtn.Text = player.GetRoomListName(); | 
 |  |  |                                 //if (player.ServerClientType == 1) | 
 |  |  |                                 //{ | 
 |  |  |                                 //    if (player.MainPlayCollection) | 
 |  |  |                                 //    { | 
 |  |  |                                 //        musicView.collectIconBtn.IsSelected = true; | 
 |  |  |                                 //    } | 
 |  |  |                                 //    else | 
 |  |  |                                 //    { | 
 |  |  |                                 //        musicView.collectIconBtn.IsSelected = false; | 
 |  |  |                                 //    } | 
 |  |  |                                 //} | 
 |  |  |                                 //else | 
 |  |  |                                 //{ | 
 |  |  |                                 //    if (player.collect) | 
 |  |  |                                 //    { | 
 |  |  |                                 //        musicView.collectIconBtn.IsSelected = true; | 
 |  |  |                                 //    } | 
 |  |  |                                 //    else | 
 |  |  |                                 //    { | 
 |  |  |                                 //        musicView.collectIconBtn.IsSelected = false; | 
 |  |  |                                 //    } | 
 |  |  |                                 //} | 
 |  |  |                             } | 
 |  |  |                             a31player.MainPlayName = str; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     catch (Exception e) | 
 |  |  |                     { | 
 |  |  |                         var ss = e.Message; | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch { } | 
 |  |  |                 catch { } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |