| | |
| | | public void Show() |
| | | { |
| | | #region 界面布局------ |
| | | this.BackgroundColor = Color.ViewColor; |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | var topView = new TopView(); |
| | | this.AddChidren(topView.TopFLayoutView()); |
| | | topView.topNameBtn.TextID = StringId.localMusic; |
| | |
| | | }; |
| | | middViewLayout = new VerticalRefreshLayout |
| | | { |
| | | BackgroundColor = Color.WhiteColor, |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | Y = topView.fLayout.Bottom, |
| | | Height = Application.GetRealHeight(H_W.H - H_W.T_Height), |
| | | }; |
| | | this.AddChidren(middViewLayout); |
| | | middViewLayout.BeginHeaderRefreshingAction += () => |
| | | { |
| | | MusicView(); |
| | | middViewLayout.EndHeaderRefreshing(); |
| | | }; |
| | | #endregion |
| | |
| | | public void MusicView() |
| | | { |
| | | middViewLayout.RemoveAll(); |
| | | for (int i = 0; i < MusicInfo.MusicInfoList.Count; i++) |
| | | { |
| | | var songs = MusicInfo.MusicInfoList[i]; |
| | | if (songs == null) |
| | | { |
| | | continue; |
| | | } |
| | | songs.URL = "http://" + new Shared.Net.NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + songs.ID; |
| | | View.SongView songView = new View.SongView(); |
| | | songView.SongFrameLayout(middViewLayout,songs); |
| | | //添加喜爱音乐控件 |
| | | songView.loveIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | songView.loveIcon.IsSelected = !songView.loveIcon.IsSelected; |
| | | if (songView.loveIcon.IsSelected) |
| | | { |
| | | ///查找音乐是否存在在列表 |
| | | var music1 = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL); |
| | | if (music1 == null) |
| | | { |
| | | ///没有存在就添加 |
| | | A31MusicModel.Current.LoveMusicInfoList.Add(songs); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ///查找音乐是否存在在列表 |
| | | var music1 = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL); |
| | | if (music1 != null) |
| | | { |
| | | ///存在就删除 |
| | | A31MusicModel.Current.LoveMusicInfoList.Remove(songs); |
| | | } |
| | | |
| | | } |
| | | A31MusicModel.Save(); |
| | | }; |
| | | //添加到我的列表 |
| | | songView.addIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | new View.DialogView { }.FieListView(songs); |
| | | }; |
| | | ///点击播放事件 |
| | | songView.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | System.Threading.Thread.Sleep(50); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //移除界面 |
| | | A31MusicModel.Current.A31PlayStatus.Title = songView.songBtn.Text; |
| | | MainPage.BasePageView.RemoveViewByTag("Music"); |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | SendMethod.PushList(songs, Language.StringByID(StringId.localMusic), MusicInfo.MusicInfoList,A31MusicModel.Current); |
| | | }); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | } |
| | | UI2.FuntionControlView.Music.UpdateThread.playMusuc(middViewLayout, "本地音乐", Language.StringByID(StringId.localMusic), MusicInfo.MusicInfoList, A31MusicModel.Current); |
| | | } |
| | | /// <summary> |
| | | /// 定时更新当前播放音乐 |