| | |
| | | { |
| | | public class MusicMain : FrameLayout |
| | | { |
| | | private static MusicMain m_MusicMain = null; |
| | | public static MusicMain mMusicMain |
| | | private static MusicMain s_Current = null; |
| | | public static MusicMain Current |
| | | { |
| | | get |
| | | { |
| | | if (m_MusicMain == null) |
| | | if (s_Current == null) |
| | | { |
| | | m_MusicMain = new MusicMain(); |
| | | s_Current = new MusicMain(); |
| | | } |
| | | return m_MusicMain; |
| | | return s_Current; |
| | | } |
| | | |
| | | } |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | base.RemoveFromParent(); |
| | | clearA31Threads(); |
| | | ClearA31Threads(); |
| | | //进来没有音乐被收藏过,退出有音乐被收藏过 |
| | | //A31MusicModel.ReadMusicStates(); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 移除线程 |
| | | /// </summary> |
| | | static void clearA31Threads() |
| | | static void ClearA31Threads() |
| | | { |
| | | |
| | | var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; }); |
| | |
| | | |
| | | public void Show() |
| | | { |
| | | |
| | | #region 界面布局 |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | var topView = new TopView(); |
| | |
| | | { |
| | | verticalRefresh.RemoveAll(); |
| | | A31MusicModel.A31MusicModelList.Clear(); |
| | | var musicListFunction = FunctionList.List.GetMusicList(); |
| | | for (int i = 0; i < musicListFunction.Count; i++) |
| | | var musicDeviceList= FunctionList.List.GetMusicList(); |
| | | for (int i = 0; i < musicDeviceList.Count; i++) |
| | | { |
| | | var function = musicListFunction[i]; |
| | | var function = musicDeviceList[i]; |
| | | var music = A31MusicModel.A31MusicModelList.Find((obj) => |
| | | (obj.functionMusic.deviceId == function.deviceId && function.spk == "music.standard") || ( |
| | | obj.functionMusic.deviceId == function.deviceId && function.spk == "av.music") |
| | | (obj.functionMusic.deviceId == function.deviceId && function.spk == SPK.MusicStandard) || ( |
| | | obj.functionMusic.deviceId == function.deviceId && function.spk == SPK.AvMusic) |
| | | ); |
| | | if (music == null) |
| | | { |
| | |
| | | { |
| | | |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | //if (a31player.functionMusic.online == false) |
| | | //if (a31player.functionMusic.isOnline() == false) |
| | | //{ |
| | | // //不在线不显示 |
| | | // continue; |
| | |
| | | { |
| | | |
| | | var a31player = A31MusicModel.A31MusicModelList[i]; |
| | | if (a31player.functionMusic.online == false) |
| | | if (a31player.functionMusic.isOnline() == false) |
| | | { |
| | | //不在线不读取 |
| | | continue; |
| | |
| | | try |
| | | { |
| | | |
| | | SendMethod.mMethod.RefreshDeviceStatus(new List<string> { a31player.functionMusic.deviceId }); |
| | | SendMethod.Current.RefreshDeviceStatus(new List<string> { a31player.functionMusic.deviceId }); |
| | | System.Threading.Thread.Sleep(500); |
| | | } |
| | | catch { } |
| | |
| | | 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.Visible = false;//先暂时隐藏收藏功能 |
| | | ///收藏事件 |
| | | musicView.collectIconBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | { |
| | | player.functionMusic.collect = false; |
| | | } |
| | | player.functionMusic.CollectFunction(); |
| | | }; |
| | | |
| | | |
| | |
| | | player.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.up); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.song_step, ValueProperty.up); |
| | | SendMethod.mMethod.SendControlCommand(player.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | musicView.prevBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | player.functionMusic.SetAttrState(KeyProperty.on_off, status); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.on_off, status); |
| | | SendMethod.mMethod.SendControlCommand(player.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | ///下一曲点击事件 |
| | | musicView.nextBtn.MouseDownEventHandler += (sender, e) => |
| | |
| | | player.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.song_step, ValueProperty.down); |
| | | SendMethod.mMethod.SendControlCommand(player.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(player.functionMusic, dic); |
| | | }; |
| | | musicView.nextBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | //更新状态线程 |
| | | var musicThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | try |
| | | { |
| | | if (!player.functionMusic.online) |
| | | while (true) |
| | | { |
| | | ///不在线不读状态 |
| | | continue; |
| | | } |
| | | //SendMethod.ReadStatus(player); |
| | | SendMethod.mMethod.GetDeviceStatus(ref player, new List<string> { player.functionMusic.deviceId }, player.functionMusic.sid); |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | 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) |
| | | if (!player.functionMusic.isOnline()) |
| | | { |
| | | musicView.playBtn.IsSelected = true; |
| | | ///不在线不读状态 |
| | | continue; |
| | | } |
| | | else |
| | | //SendMethod.ReadStatus(player); |
| | | SendMethod.Current.GetDeviceStatus(ref player, new List<string> { player.functionMusic.deviceId }, player.functionMusic.sid); |
| | | System.Threading.Thread.Sleep(1000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | musicView.playBtn.IsSelected = false; |
| | | } |
| | | musicView.regionBtn.Text = player.functionMusic.GetRoomListName(); |
| | | 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; |
| | | } |
| | | }); |
| | | if (player.functionMusic.collect) |
| | | { |
| | | musicView.collectIconBtn.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | musicView.collectIconBtn.IsSelected = false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ee = e.Message; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ee = e.Message; |
| | | } |
| | | }) |
| | | { IsBackground = true, Name = "A31" }; |
| | |
| | | catch { } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |