| | |
| | | { |
| | | |
| | | ///1秒定时更新状态 |
| | | timerUpdateStatus(); |
| | | TimerUpdateStatus(); |
| | | #region ---界面布局--- |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | topView = new TopView(); |
| | |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.mode, modeValueString); |
| | | //发送控制指令 |
| | | SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | }; |
| | | ///添加喜爱点击事件; |
| | | playView.loveBtn.MouseUpEventHandler += (sender, e) => |
| | |
| | | return name == musicInfo.name; |
| | | })) |
| | | { |
| | | A31MusicModel.Current.LoveMusicInfoList.Add(new Songs { name = name, time = songTime }); |
| | | A31MusicModel.Current.LoveMusicInfoList.Add(new SongInfo { name = name, time = songTime }); |
| | | } |
| | | } |
| | | else |
| | |
| | | ///下拉刷新 |
| | | myListView.verticalScrolViewLayout.BeginHeaderRefreshingAction += () => |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | System.Threading.Tasks.Task.Run((() => |
| | | { |
| | | try |
| | | { |
| | | A31MusicModel.Current.palyLists.Clear(); |
| | | if (A31MusicModel.Current.palyLists.Count == 0) |
| | | A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); |
| | | if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) |
| | | { |
| | | SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic); |
| | | SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic, () => |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //myListView.verticalScrolViewLayout.EndHeaderRefreshing(); |
| | | myListView.verticalScrolViewLayout.RemoveAll(); |
| | | var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); |
| | | var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); |
| | | var musicList = A31MusicModel.Current.GetSongList(listName); |
| | | A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra); |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | } |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | myListView.verticalScrolViewLayout.EndHeaderRefreshing(); |
| | | myListView.verticalScrolViewLayout.RemoveAll(); |
| | | var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); |
| | | var musicList = A31MusicModel.Current.GetSongList(listName); |
| | | A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, myListView.popFra); |
| | | //myListView.verticalScrolViewLayout.RemoveAll(); |
| | | //var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); |
| | | //var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); |
| | | //var musicList = A31MusicModel.Current.GetSongList(listName); |
| | | |
| | | //A31SongPlay.SongListView(myListView.verticalScrolViewLayout, musicList, listName, source, myListView.popFra); |
| | | }); |
| | | } |
| | | }); |
| | | })); |
| | | //结束刷新 |
| | | |
| | | }; |
| | |
| | | //var musicList = A31MusicModel.Current.GetSongList(listName); |
| | | //new A31SongPlay { }.SongListView(myListView.verticalScrolViewLayout, musicList, listName); |
| | | |
| | | PlayListView(myListView.popFra, myListView.verticalScrolViewLayout); |
| | | UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout); |
| | | this.PlayListView(myListView.popFra, myListView.verticalScrolViewLayout, loading); |
| | | this.UpdateSelectedMusic(myListView.popFra, myListView.verticalScrolViewLayout); |
| | | |
| | | }; |
| | | ///音量图标点击事件 |
| | |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.volume, startVolume.ToString()); |
| | | SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | |
| | | } |
| | | }; |
| | |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.song_step, ValueProperty.down); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.song_step, ValueProperty.up); |
| | | SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | |
| | | }; |
| | | playView.prevBtn.MouseUpEventHandler += (sender, e) => |
| | |
| | | A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.on_off, status); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add(KeyProperty.on_off, status); |
| | | SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | }; |
| | | ///下一曲点击事件 |
| | | playView.nextBtn.MouseDownEventHandler += (sender, e) => |
| | |
| | | A31MusicModel.Current.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(A31MusicModel.Current.functionMusic, dic); |
| | | SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); |
| | | }; |
| | | playView.nextBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 定时更新状态 |
| | | /// </summary> |
| | | void timerUpdateStatus() |
| | | void TimerUpdateStatus() |
| | | { |
| | | timerThread = new System.Threading.Thread((obj) => |
| | | { |
| | |
| | | /// 加载播放音乐列表View |
| | | /// </summary> |
| | | /// <param name="verticalScrolViewLayout"></param> |
| | | void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout) |
| | | private void PlayListView(FrameLayout frameLayout, VerticalRefreshLayout verticalScrolViewLayout, Loading loading) |
| | | { |
| | | verticalScrolViewLayout.RemoveAll(); |
| | | //获取播放器名称 |
| | | var listName = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playlist_name); |
| | | var source = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.source); |
| | | //获取缓存歌曲列表 |
| | | var musicList = A31MusicModel.Current.GetSongList(listName); |
| | | loading.Start(); |
| | | if (musicList.Count == 0) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | System.Threading.Tasks.Task.Run((() => |
| | | { |
| | | try |
| | | { |
| | | A31MusicModel.Current.palyLists.Clear(); |
| | | if (A31MusicModel.Current.palyLists.Count == 0) |
| | | A31MusicModel.Current.CurrentPlayMusicInfoList.Clear(); |
| | | if (A31MusicModel.Current.CurrentPlayMusicInfoList.Count == 0) |
| | | { |
| | | //获取歌曲列表 |
| | | SendMethod.mMethod.GetPalyList(A31MusicModel.Current.functionMusic); |
| | | SendMethod.Current.GetCurrentPalyList(A31MusicModel.Current.functionMusic, () => |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | musicList = A31MusicModel.Current.GetSongList(listName); |
| | | A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); |
| | | |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | musicList = A31MusicModel.Current.GetSongList(listName); |
| | | A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); |
| | | loading.Hide(); |
| | | //musicList = A31MusicModel.Current.GetSongList(listName); |
| | | //A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); |
| | | }); |
| | | } |
| | | }); |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, frameLayout); |
| | | A31SongPlay.SongListView(verticalScrolViewLayout, musicList, listName, source, frameLayout); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 定时更新当前播放音乐 |
| | | /// </summary> |
| | | void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout) |
| | | private void UpdateSelectedMusic(FrameLayout frameLayout, VerticalRefreshLayout middViewLayout) |
| | | { |
| | | UpdateThread.updateCurrMusicThread(frameLayout, middViewLayout, A31MusicModel.Current); |
| | | } |