From c26c06ef4a22d6fb9e59dc734abca92fa8a23c47 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 05 六月 2020 17:41:00 +0800
Subject: [PATCH] 2020-06-05-02

---
 HDL_ON/UI/Music/A31LoveMusicList.cs |   53 ++++++++++++++---------------------------------------
 1 files changed, 14 insertions(+), 39 deletions(-)

diff --git a/HDL_ON/UI/Music/A31LoveMusicList.cs b/HDL_ON/UI/Music/A31LoveMusicList.cs
index d055f26..9f97cd0 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);
                             });
                         });
                     });
@@ -365,7 +340,7 @@
 
                 sb.AppendLine("&amp;lt;dc:title&amp;gt;" + tempMusicInfo.Title + "&amp;lt;/dc:title&amp;gt;");
                 sb.AppendLine("&amp;lt;dc:creator&amp;gt;DJ Sanny J&amp;lt;/dc:creator&amp;gt;");
-                sb.AppendLine("&amp;lt;upnp:artist&amp;gt;" + tempMusicInfo.Artist + "&amp;lt;/upnp:artist&amp;gt;");
+                sb.AppendLine("&amp;lt;upnp:artist&amp;gt;" + listName + "&amp;lt;/upnp:artist&amp;gt;");
                 sb.AppendLine("&amp;lt;upnp:album&amp;gt;" + tempMusicInfo.Album + "&amp;lt;/upnp:album&amp;gt;");
                 sb.AppendLine("&amp;lt;upnp:albumArtURI&amp;gt;unknown&amp;lt;/upnp:albumArtURI&amp;gt;");
                 sb.AppendLine("&amp;lt;/item&amp;gt;");

--
Gitblit v1.8.0