| | |
| | | using Shared; |
| | | using Shared.IO; |
| | | using System.Net; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Music; |
| | | |
| | | namespace HDL_ON.UI.Music |
| | | { |
| | | public class MusicMain : FrameLayout |
| | | { |
| | | private static MusicMain s_Current = null; |
| | | public static MusicMain Current |
| | | { |
| | | get |
| | | { |
| | | if (s_Current == null) |
| | | { |
| | | s_Current = new MusicMain(); |
| | | } |
| | | return s_Current; |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// MusicMain对象构造函数 |
| | | /// </summary> |
| | | public MusicMain() |
| | | { |
| | | Tag = "MusicMain"; |
| | | //进来音乐列表界面先移除之前线程; |
| | | A31MusicModel.RemoveListThread(); |
| | | } |
| | | /// <summary> |
| | | /// 重写RemoveFromParent方法 |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | base.RemoveFromParent(); |
| | | clearA31Threads(); |
| | | A31MusicModel.ReadMusicStates();//进来没有音乐被收藏过,退出有音乐被收藏过 |
| | | ClearA31Threads(); |
| | | //进来没有音乐被收藏过,退出有音乐被收藏过 |
| | | //A31MusicModel.ReadMusicStates(); |
| | | } |
| | | /// <summary> |
| | | /// 创建线程列表 |
| | |
| | | /// <summary> |
| | | /// 移除线程 |
| | | /// </summary> |
| | | static void clearA31Threads() |
| | | static void ClearA31Threads() |
| | | { |
| | | |
| | | var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; }); |
| | | foreach (var thread in threads) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 显示加载界面 |
| | | /// </summary> |
| | | public static Loading loading = new Loading(); |
| | | public static Loading loading = new Loading(); |
| | | /// <summary> |
| | | /// 定义全局对象 |
| | | /// </summary> |
| | | VerticalRefreshLayout verticalRefresh; |
| | | |
| | | 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(); |
| | |
| | | { |
| | | Y = topView.fLayout.Bottom, |
| | | Height = Application.GetRealHeight(H_W.H - H_W.T_Height), |
| | | Name = "verticalRefresh", |
| | | }; |
| | | this.AddChidren(verticalRefresh); |
| | | #endregion |
| | | |
| | | verticalRefresh.BeginHeaderRefreshingAction += () => |
| | | { |
| | | SeachMusic(false); |
| | | |
| | | |
| | | ////发送读取音乐播放器状态线程 |
| | | SeachMusic(); |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | }; |
| | | 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(); |
| | | A31MusicModel.A31MusicModelList.Clear(); |
| | | var musicDeviceList= FunctionList.List.GetMusicList(); |
| | | for (int i = 0; i < musicDeviceList.Count; i++) |
| | | { |
| | | readServerOrClientMode(); |
| | | A31MusicModel.Save(); |
| | | if (!Yes) |
| | | var function = musicDeviceList[i]; |
| | | var music = A31MusicModel.A31MusicModelList.Find((obj) => |
| | | (obj.functionMusic.deviceId == function.deviceId && function.spk == SPK.MusicStandard) || ( |
| | | obj.functionMusic.deviceId == function.deviceId && function.spk == SPK.AvMusic) |
| | | ); |
| | | if (music == null) |
| | | { |
| | | ///等待跑完在关闭 |
| | | verticalRefresh.EndHeaderRefreshing(); |
| | | A31MusicModel.A31MusicModelList.Add(new A31MusicModel { functionMusic = function }); |
| | | } |
| | | else |
| | | { |
| | | music.functionMusic = function; |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | //if (a31player.functionMusic.isOnline() == false) |
| | | //{ |
| | | // //不在线不显示 |
| | | // continue; |
| | | //} |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (Yes) |
| | | MusicListView(a31player); |
| | | }); |
| | | } |
| | | ///进来读一次音乐播放器状态 |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | { |
| | | |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | if (a31player.functionMusic.isOnline() == false) |
| | | { |
| | | //不在线不读取 |
| | | continue; |
| | | } |
| | | //发送读取音乐播放器状态线程 |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | try |
| | | { |
| | | //为了第一次进来log一下; |
| | | loading.Hide(); |
| | | |
| | | SendMethod.Current.RefreshDeviceStatus(new List<string> { a31player.functionMusic.deviceId }); |
| | | System.Threading.Thread.Sleep(500); |
| | | } |
| | | 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(); |
| | | catch { } |
| | | |
| | | }); |
| | | 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(A31MusicModel player) |
| | | { |
| | | /// <summary> |
| | | /// 为了音乐刷新状态定义全局对象 |
| | | /// </summary> |
| | | 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.ViewAddChidren(verticalRefresh); |
| | | musicView.muiscFl.Tag = player.functionMusic;//多个音乐播放器更新状态要用到 |
| | | musicView.singerBtn.Text = player.functionMusic.GetAttrState(KeyProperty.song_name); |
| | | musicView.songNameBtn.Text = player.functionMusic.GetAttrState(KeyProperty.song_name); |
| | | musicView.musicNameBtn.Text = player.functionMusic.name; |
| | | //musicView.collectIconBtn.Visible = false;//先暂时隐藏收藏功能 |
| | | ///收藏事件 |
| | | 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.functionMusic.collect = true; |
| | | } |
| | | else |
| | | { |
| | | if (musicView.collectIconBtn.IsSelected) |
| | | { |
| | | a31player.collect = true; |
| | | } |
| | | else |
| | | { |
| | | a31player.collect = false; |
| | | } |
| | | player.functionMusic.collect = false; |
| | | } |
| | | A31MusicModel.Save(); |
| | | player.functionMusic.CollectFunction(); |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> clickMergence = (sender, e) => |
| | | { |
| | | if (a31player.ServerClientType == 0) |
| | | { |
| | | new View.DialogView { }.PlayMergence(a31player); |
| | | } |
| | | else if (a31player.ServerClientType == 1) |
| | | { |
| | | new View.DialogView { }.DetachPlayMergence(a31player); |
| | | |
| | | } |
| | | }; |
| | | musicView.mergeBjBtn.MouseUpEventHandler += clickMergence; |
| | | musicView.mergeBtn.MouseUpEventHandler += clickMergence; |
| | | musicView.mergeIconBtn.MouseUpEventHandler += clickMergence; |
| | | |
| | | ///进入音乐主页事件 |
| | | EventHandler<MouseEventArgs> clickPlayView = (sender, e) => |
| | | { |
| | | A31MusicModel.Current = a31player;//当前播放器 |
| | | |
| | | A31MusicModel.Current = player; |
| | | var a31PlayMusicPage = new A31PlayMusicPage(); |
| | | MainPage.BasePageView.AddChidren(a31PlayMusicPage); |
| | | a31PlayMusicPage.Show(); |
| | |
| | | musicView.prevBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | musicView.prevBtn.IsSelected = true; |
| | | SendMethod.Previous(a31player); |
| | | player.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.up); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.song_step, ValueProperty.up); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | musicView.prevBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | ///暂停/播放点击事件 |
| | | musicView.playBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | string status = ValueProperty.off; |
| | | if (musicView.playBtn.IsSelected) |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | SendMethod.Pause(a31player); |
| | | a31player.A31PlayStatus.status = "pause"; |
| | | status = ValueProperty.off; |
| | | } |
| | | else |
| | | { |
| | | musicView.playBtn.IsSelected = true; |
| | | SendMethod.Play(a31player); |
| | | a31player.A31PlayStatus.status = "play"; |
| | | status = ValueProperty.on; |
| | | } |
| | | player.functionMusic.SetAttrState(KeyProperty.on_off, status); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.on_off, status); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | ///下一曲点击事件 |
| | | musicView.nextBtn.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | musicView.nextBtn.IsSelected = true; |
| | | SendMethod.Next(a31player); |
| | | player.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.song_step, ValueProperty.down); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | musicView.nextBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | musicView.nextBtn.IsSelected = false; |
| | | }; |
| | | |
| | | //更新状态线程 |
| | | var musicThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | try |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (!a31player.IsOnLine) |
| | | while (true) |
| | | { |
| | | continue; |
| | | if (!player.functionMusic.isOnline()) |
| | | { |
| | | ///不在线不读状态 |
| | | continue; |
| | | } |
| | | //SendMethod.ReadStatus(player); |
| | | SendMethod.Current.GetDeviceStatus(ref player, new List<string> { player.functionMusic.deviceId }, player.functionMusic.sid); |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | musicView.singerBtn.Text = player.functionMusic.GetAttrState(KeyProperty.song_name); |
| | | musicView.songNameBtn.Text = player.functionMusic.GetAttrState(KeyProperty.song_name); |
| | | musicView.musicNameBtn.Text = player.functionMusic.name; |
| | | if (player.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on) |
| | | { |
| | | musicView.playBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | } |
| | | musicView.regionBtn.Text = player.functionMusic.GetRoomListName(); |
| | | |
| | | if (player.functionMusic.collect) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ee = e.Message; |
| | | } |
| | | }); |
| | | } |
| | | SendMethod.ReadStatus(a31player); |
| | | 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; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ee = e.Message; |
| | | } |
| | | }) |
| | | { IsBackground = true, Name = "A31" }; |
| | | musicThread.Start(); |
| | | threadLists.Add(musicThread); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取主从关系 |
| | | ///指定刷新界面 |
| | | /// </summary> |
| | | void readServerOrClientMode() |
| | | /// <param name="strView">判断字符</param> |
| | | public void RefreshView(AlinkStatusData alinkStatusData) |
| | | { |
| | | try |
| | | if (alinkStatusData == null || alinkStatusData.status.Count == 0) |
| | | { |
| | | for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) |
| | | return; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | if (!a31player.IsOnLine) |
| | | for (int a =0; a < MainPage.BasePageView.ChildrenCount; a++) |
| | | { |
| | | 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(a); |
| | | if (view.GetType() == typeof(MusicMain)) |
| | | { |
| | | 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++) |
| | | var musicMain = view as MusicMain; |
| | | if (musicMain != null) |
| | | { |
| | | |
| | | 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) |
| | | for (int b = 0; b < musicMain.ChildrenCount; b++) |
| | | { |
| | | A31MusicModel.A31MusicModelList.Add(new A31MusicModel |
| | | var view1 = musicMain.GetChildren(b); |
| | | if (view1.GetType() == typeof(VerticalRefreshLayout)) |
| | | { |
| | | 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作用为了读取从播放器的音量 |
| | | var vv = view1 as VerticalRefreshLayout; |
| | | if (vv != null && vv.Name == "verticalRefresh") |
| | | { |
| | | for (int c = 0; c < vv.ChildrenCount; c++) |
| | | { |
| | | var viewfl = vv.GetChildren(c); |
| | | if (viewfl.GetType() == typeof(FrameLayout)) |
| | | { |
| | | var fl = viewfl as FrameLayout; |
| | | if ((fl.Tag as Function).sid!= alinkStatusData.sid) { |
| | | //不是当前音乐不会更新状态 |
| | | continue; |
| | | } |
| | | if (fl != null && fl.Name == "parentfl") |
| | | { |
| | | for (int i = 0; i < fl.ChildrenCount; i++) |
| | | { |
| | | var viewfl1 = fl.GetChildren(i); |
| | | if (viewfl1.GetType() == typeof(FrameLayout)) |
| | | { |
| | | var fl1 = viewfl1 as FrameLayout; |
| | | if (fl1 != null && fl1.Name == "musicparentfl") |
| | | { |
| | | for (int j = 0; j < fl1.ChildrenCount; j++) |
| | | { |
| | | |
| | | if (fl1.GetChildren(j).GetType() == typeof(Button)) |
| | | { |
| | | var btn = fl1.GetChildren(j) as Button; |
| | | if (btn == null ||btn.Name==null) |
| | | { |
| | | continue; |
| | | } |
| | | switch (btn.Name) |
| | | { |
| | | case "song": |
| | | { |
| | | var s = alinkStatusData.status.Find((o) => o.key == KeyProperty.song_name); |
| | | if (s != null) |
| | | { |
| | | btn.Text = s.value; |
| | | } |
| | | } |
| | | break; |
| | | case "playstatus": |
| | | { |
| | | |
| | | var s = alinkStatusData.status.Find((o) => o.key == KeyProperty.on_off); |
| | | if (s != null) |
| | | { |
| | | if (s.value == ValueProperty.on) |
| | | { |
| | | btn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btn.IsSelected = false; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | a31player.MainPlayName = str; |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | var ss = e.Message; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch { } |
| | | } |
| | | catch { } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |