From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:34:32 +0800 Subject: [PATCH] 2024年07月25日17:33:40 --- HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs | 117 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 79 insertions(+), 38 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs index 1ec1ba3..d3bc3b7 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31SongPlay.cs @@ -2,6 +2,7 @@ using Shared; using HDL_ON.UI.Music; using System.Collections.Generic; +using HDL_ON.UI.UI2.FuntionControlView.Music; namespace HDL_ON.UI.Music { @@ -13,13 +14,14 @@ Tag = "Music"; } - public void Show(List<Songs> musicList,string listName) + + public void Show(SongList songLists) { this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); - topView.topNameBtn.TextID = StringId.localMusic; + topView.topNameBtn.Text=songLists.group; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); @@ -33,10 +35,33 @@ this.AddChidren(vv); vv.BeginHeaderRefreshingAction += () => { - vv.EndHeaderRefreshing(); + System.Threading.Tasks.Task.Run(() => + { + try + { + //鑾峰彇姝屾洸鍒楄〃 + var songList = SendMethod.Current.GetSingleSongList(A31MusicModel.Current.functionMusic, songLists.group, songLists.source); + CommonMethod.Current.AddSongListMemory(songList, songLists.source);//淇濆瓨缂撳瓨 + } + catch + { + } + finally + { + Application.RunOnMainThread(() => + { + vv.EndHeaderRefreshing(); + //浠庣紦瀛樻嬁鍒楄〃 + var songListMemory = CommonMethod.Current.GetSongListMemory(songLists.group, songLists.source); + ///鍔犺浇闊充箰鍒楄〃 + SongListView(vv, songListMemory.songs, songListMemory.group, songLists.source); + + }); + } + }); }; ///鍔犺浇闊充箰鍒楄〃 - SongListView(vv, musicList, listName); + SongListView(vv, songLists.songs, songLists.group,songLists.source); } @@ -46,8 +71,12 @@ /// <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) { - + /// <param name="source">闊充箰婧�</param> + public static void SongListView(VerticalRefreshLayout vv, List<SongInfo> musicList, string listName,string source, FrameLayout frame = null) + { + if (vv!=null) { + vv.RemoveAll(); + } for (int i = 0; i < musicList.Count; i++) { var songs = musicList[i]; @@ -66,7 +95,7 @@ System.Threading.Thread.Sleep(50); Application.RunOnMainThread(() => { - //绉婚櫎鐣岄潰 + //淇敼缂撳瓨灞炴�х姸鎬佸�� A31MusicModel.Current.functionMusic.SetAttrState("song_name", songView.songBtn.Text); A31MusicModel.Current.functionMusic.SetAttrState("playlist_name", listName); //绉婚櫎鐣岄潰 @@ -78,7 +107,15 @@ 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); + if (!string.IsNullOrEmpty(songs.url)) + { + dic.Add("url", songs.url); + } + if (!string.IsNullOrEmpty(source)) + { + dic.Add("source", source); + } + SendMethod.Current.SendControlCommand(A31MusicModel.Current.functionMusic, dic); }); }); }; @@ -103,47 +140,51 @@ { System.Threading.Thread updateSelectedMusicThread = new System.Threading.Thread(() => { - while (frame.Parent != null) + try { - //A31MusicModel.LogMusic("宸插惎鍔ㄦ洿鏂伴煶涔愬垪琛ㄦ煇涓�鏉¢煶涔愮姸鎬佺殑绾跨▼"); - System.Threading.Thread.Sleep(1000); - Application.RunOnMainThread(() => + while (frame.Parent != null) { - try + //A31MusicModel.LogMusic("宸插惎鍔ㄦ洿鏂伴煶涔愬垪琛ㄦ煇涓�鏉¢煶涔愮姸鎬佺殑绾跨▼"); + System.Threading.Thread.Sleep(1000); + Application.RunOnMainThread(() => { - for (int i = 0; i < middViewLayout.ChildrenCount; i++) + try { - 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; - //} + 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 { } + catch { } - }); + }); + } } + catch (Exception e) { } }); updateSelectedMusicThread.Start(); } - + } } -- Gitblit v1.8.0