From 0c1b0cdf903114c4214f6b9298ecd440972a42b5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 14 一月 2022 13:13:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/wjc' into wxr0114 --- HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 149 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs new file mode 100644 index 0000000..1ec1ba3 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs @@ -0,0 +1,149 @@ +锘縰sing 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<Songs> musicList,string listName) + { + + this.BackgroundColor = MusicColor.ViewColor; + var topView = new TopView(); + this.AddChidren(topView.TopFLayoutView()); + topView.topNameBtn.TextID = StringId.localMusic; + 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); + vv.BeginHeaderRefreshingAction += () => + { + vv.EndHeaderRefreshing(); + }; + ///鍔犺浇闊充箰鍒楄〃 + SongListView(vv, musicList, listName); + + + } + /// <summary> + /// 鍔犺浇闊充箰鍒楄〃 + /// </summary> + /// <param name="vv">鐖舵帶浠�</param> + /// <param name="musicList">闊充箰鍒楄〃</param> + /// <param name="listName">鍒楄〃鍚�</param> + public static void SongListView(VerticalRefreshLayout vv,List<Songs> musicList,string listName, FrameLayout frame = null) { + + 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.songBtn.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); + //绉婚櫎鐣岄潰 + if (frame != null) + { + frame.RemoveFromParent(); + } + MainPage.BasePageView.RemoveViewByTag("Music"); + Dictionary<string, string> dic = new Dictionary<string, string>(); + dic.Add("song_name", songView.songBtn.Text); + dic.Add("playlist_name", listName); + SendMethod.mMethod.SendControlCommand(A31MusicModel.Current.functionMusic, dic); + }); + }); + }; + + } + + } + } + + public class UpdateThread + { + public UpdateThread() + { + } + /// <summary> + /// 瀹氭椂鏇存柊褰撳墠鎾斁闊充箰 + /// </summary> + /// <param name="frame">褰撳墠鐣岄潰</param> + /// <param name="middViewLayout">姣忎竴鏉¢煶涔愮殑涓绘帶浠�</param> + /// <param name="a31MusicModel">鐐瑰墠鎾斁鍣�</param> + public static void updateCurrMusicThread(FrameLayout frame, VerticalRefreshLayout middViewLayout, A31MusicModel a31MusicModel) + { + System.Threading.Thread updateSelectedMusicThread = new System.Threading.Thread(() => + { + while (frame.Parent != null) + { + //A31MusicModel.LogMusic("宸插惎鍔ㄦ洿鏂伴煶涔愬垪琛ㄦ煇涓�鏉¢煶涔愮姸鎬佺殑绾跨▼"); + System.Threading.Thread.Sleep(1000); + Application.RunOnMainThread(() => + { + try + { + for (int i = 0; i < middViewLayout.ChildrenCount; i++) + { + RowLayout view = (RowLayout)middViewLayout.GetChildren(i); + var volIconBtn = (Button)view.GetChildren(0);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button + var songNameBtn = (Button)view.GetChildren(1);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button + var artistNameBtn = (Button)view.GetChildren(2);//鐩存帴FrameLayout鐖舵帶浠舵壘鍒拌鎺т欢Button + //if (a31MusicModel.A31PlayStatus.TrackURL == songNameBtn.Tag.ToString()) + //{ + // volIconBtn.Visible = true; + // songNameBtn.TextColor = UI.Music.MusicColor.SelectedColor; + // songNameBtn.X = Application.GetRealWidth(48); + // artistNameBtn.X = songNameBtn.Right; + // artistNameBtn.TextColor = UI.Music.MusicColor.SelectedColor; + //} + //else + //{ + // volIconBtn.Visible = false; + // songNameBtn.TextColor = UI.Music.MusicColor.MusicTxet14Color; + // songNameBtn.X = Application.GetRealWidth(16); + // artistNameBtn.X = songNameBtn.Right; + // artistNameBtn.TextColor = UI.Music.MusicColor.MusicNoTxetColor; + //} + + + } + } + catch { } + + }); + } + }); + updateSelectedMusicThread.Start(); + } + + } +} -- Gitblit v1.8.0