using System; using Shared; using HDL_ON.UI.Music; using System.Collections.Generic; namespace HDL_ON.UI.Music { public class A31SongPlay : FrameLayout { public A31SongPlay() { Tag = "Music"; } public void Show(List musicList,string listName) { this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); topView.topNameBtn.TextID = StringId.usb; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; var vv = new VerticalRefreshLayout { BackgroundColor = MusicColor.WhiteColor, Y = topView.fLayout.Bottom, Height = Application.GetRealHeight(H_W.H - H_W.T_Height), }; this.AddChidren(vv); ///加载音乐列表 SongListView(vv, musicList, listName); } /// /// 加载音乐列表 /// /// 父控件 /// 音乐列表 /// 列表名 public void SongListView(VerticalRefreshLayout vv,List musicList,string listName) { for (int i = 0; i < musicList.Count; i++) { var songs = musicList[i]; if (songs == null) { continue; } UI.Music.View.SongView songView = new UI.Music.View.SongView(); songView.SongFrameLayout(vv, songs); songView.singerBtn.Text = songs.name; ///点击播放事件 songView.clickBtn.MouseUpEventHandler += (sender, e) => { System.Threading.Tasks.Task.Run(() => { System.Threading.Thread.Sleep(50); Application.RunOnMainThread(() => { //移除界面 A31MusicModel.Current.functionMusic.SetAttrState("song_name", songView.songBtn.Text); A31MusicModel.Current.functionMusic.SetAttrState("playlist_name", listName); MainPage.BasePageView.RemoveViewByTag("Music"); Dictionary dic = new Dictionary(); dic.Add("song_name", songView.songBtn.Text); dic.Add("playlist_name", listName); SendMethod.sendMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }); }); }; } } } }