From 258d1675d02d3610cb302514fb5c86ab68ee6571 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 25 五月 2020 17:51:13 +0800 Subject: [PATCH] 2020-05-25-1 --- HDL_ON/UI/Music/A31LoveMusicList.cs | 51 +++++++++++++-------------------------------------- 1 files changed, 13 insertions(+), 38 deletions(-) diff --git a/HDL_ON/UI/Music/A31LoveMusicList.cs b/HDL_ON/UI/Music/A31LoveMusicList.cs index d055f26..8e099af 100644 --- a/HDL_ON/UI/Music/A31LoveMusicList.cs +++ b/HDL_ON/UI/Music/A31LoveMusicList.cs @@ -17,14 +17,14 @@ /// <summary> /// 鍏堝姞杞界晫闈㈠嚭鏉� /// </summary> - public void Show(string listName, List<MusicInfo>loveList) + public void Show() { #region 鐣岄潰甯冨眬------ this.BackgroundColor = Color.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); - topView.topNameBtn.Text= listName; + topView.topNameBtn.TextID = StringId.a31Music; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { @@ -46,17 +46,17 @@ middViewLayout.EndHeaderRefreshing(); }; #endregion - MusicView(listName, loveList); + MusicView(Language.StringByID(StringId.a31Music)); } /// <summary> /// 鍔犺浇鏁版嵁鐨勬柟娉� /// </summary> - public void MusicView(string listName, List<MusicInfo> loveList) + public void MusicView(string listName) { middViewLayout.RemoveAll(); - for (int i = 0; i < loveList.Count; i++) + for (int i = 0; i < A31MusicModel.Current.LoveMusicInfoList.Count; i++) { - var songs = loveList[i]; + var songs = A31MusicModel.Current.LoveMusicInfoList[i]; if (string.IsNullOrEmpty(songs.Title)) { //闃叉姝屾洸鍚嶅瓧涓虹┖鎶涘紓甯� @@ -140,45 +140,20 @@ Y = Application.GetRealHeight(8), Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), - UnSelectedImagePath = "MusicIcon/love.png", - SelectedImagePath = "MusicIcon/loveSelected.png", + UnSelectedImagePath = "MusicIcon/loveSelected.png", }; musicViewFl.AddChidren(loveIcon); loveIcon.MouseUpEventHandler += (sender, e) => { - loveIcon.IsSelected = !loveIcon.IsSelected; - if (loveIcon.IsSelected) + var music= A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL); + if (music!= null) { - ///鏌ユ壘闊充箰鏄惁瀛樺湪鍦ㄥ垪琛� - 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.Current.LoveMusicInfoList.Remove(music); } A31MusicModel.Save(); + musicViewFl.RemoveFromParent(); }; - var music = A31MusicModel.Current.LoveMusicInfoList.Find((m) => m.URL == songs.URL); - if (music != null) - { - loveIcon.IsSelected = true; - } - else - { - loveIcon.IsSelected = false; - } //娣诲姞鍒版垜鐨勫垪琛� Button addIcon = new Button @@ -217,7 +192,7 @@ MainPage.BasePageView.RemoveViewByTag("Music"); System.Threading.Tasks.Task.Run(() => { - PushList(songs, listName, loveList); + PushList(songs, listName, A31MusicModel.Current.LoveMusicInfoList); }); }); }); -- Gitblit v1.8.0