From 7167334c0e89dd84827d59e726123d14776e3a09 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 16 六月 2020 11:14:13 +0800
Subject: [PATCH] 2020-06-16-1

---
 HDL_ON/UI/Music/A31LoveMusicList.cs |   65 ++++++++++++--------------------
 1 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/HDL_ON/UI/Music/A31LoveMusicList.cs b/HDL_ON/UI/Music/A31LoveMusicList.cs
index d055f26..af52c41 100644
--- a/HDL_ON/UI/Music/A31LoveMusicList.cs
+++ b/HDL_ON/UI/Music/A31LoveMusicList.cs
@@ -17,20 +17,28 @@
         /// <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) =>
             {
 
-                if (updateSelectedMusicThread != null || updateSelectedMusicThread.IsAlive)
+                if (updateSelectedMusicThread != null)
                 {
-                    updateSelectedMusicThread.Abort();
+                    try
+                    {
+                        if (updateSelectedMusicThread.IsAlive)
+                        {
+                            updateSelectedMusicThread.Abort();
+                            ///鍏抽棴绾跨▼
+                        }
+                    }
+                    catch { }
                 }
                 this.RemoveFromParent();
             };
@@ -46,17 +54,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 +148,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 +200,7 @@
                             MainPage.BasePageView.RemoveViewByTag("Music");
                             System.Threading.Tasks.Task.Run(() =>
                             {
-                                PushList(songs, listName, loveList);
+                                PushList(songs, listName, A31MusicModel.Current.LoveMusicInfoList);
                             });
                         });
                     });
@@ -365,7 +348,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