From 2bec9c838d2d688025698de8ec1de401ffd7dd1f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 11 八月 2020 14:13:55 +0800
Subject: [PATCH] 20200811

---
 HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs |  106 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 62 insertions(+), 44 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
index b4087a2..4cf1f92 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
@@ -8,51 +8,64 @@
     public class MusicMain : FrameLayout
     {
 
-        //FrameLayout Frame = null;
-        //public MusicListViewMain() {
-        //    Frame = this;
-        //}
+        /// <summary>
+        /// MusicMain瀵硅薄鏋勯�犲嚱鏁�
+        /// </summary>
         public MusicMain()
         {
             Tag = "MusicMain";
+            //杩涙潵闊充箰鍒楄〃鐣岄潰鍏堢Щ闄や箣鍓嶇嚎绋�;
+            A31MusicModel.RemoveListThread();
         }
-        //public override void RemoveFromParent()
-        //{
-        //    base.RemoveFromParent();
-        //    clearA31Threads();
-        //}
-
-        //static void clearA31Threads()
-        //{
-        //    var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; });
-        //    foreach (var thread in threads)
-        //    {
-        //        try
-        //        {
-        //            threadLists.Remove(thread);
-        //            if (thread.IsAlive)
-        //            {
-        //                thread.Abort();
-        //            }
-        //        }
-        //        catch (Exception e)
-        //        {
-        //            MainPage.Log("clearA31Threads error : " +e.Message);
-        //        }
-        //    }
-        //}
-
-
+        /// <summary>
+        /// 閲嶅啓RemoveFromParent鏂规硶
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            base.RemoveFromParent();
+            clearA31Threads();
+            A31MusicModel.ReadMusicStates();//杩涙潵娌℃湁闊充箰琚敹钘忚繃锛岄��鍑烘湁闊充箰琚敹钘忚繃
+        }
+        /// <summary>
+        /// 鍒涘缓绾跨▼鍒楄〃
+        /// </summary>
+        static List<System.Threading.Thread> threadLists = new List<System.Threading.Thread>();
+        /// <summary>
+        /// 绉婚櫎绾跨▼
+        /// </summary>
+        static void clearA31Threads()
+        {
+            var threads = threadLists.FindAll((obj) => { return obj.Name == "A31"; });
+            foreach (var thread in threads)
+            {
+                try
+                {
+                    threadLists.Remove(thread);
+                    if (thread.IsAlive)
+                    {
+                        ///寮哄埗绾跨▼鎶涘紓甯�
+                        thread.Abort();
+                    }
+                }
+                catch (Exception e)
+                {
+                    MainPage.Log("clearA31Threads error : " + e.Message);
+                }
+            }
+        }
         /// <summary>
         ///  鏄剧ず鍔犺浇鐣岄潰
         /// </summary>
         public  static Loading loading = new Loading();
+        /// <summary>
+        /// 瀹氫箟鍏ㄥ眬瀵硅薄
+        /// </summary>
         VerticalRefreshLayout verticalRefresh;
-
         public void Show()
         {
+
             #region 鐣岄潰甯冨眬
-            this.BackgroundColor = Color.ViewColor;
+            this.BackgroundColor = MusicColor.ViewColor;
             var topView = new TopView();
             this.AddChidren(topView.TopFLayoutView());
             topView.topNameBtn.TextID =StringId.a31Music;
@@ -82,7 +95,7 @@
             }
             else
             {
-                //clearA31Threads();
+                clearA31Threads();
                //verticalRefresh.RemoveAll();
                 for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
                 {
@@ -131,7 +144,10 @@
                 });
             }
         }
-
+        /// <summary>
+        /// 鍒锋柊鎾斁鍣ㄥ垪琛�
+        /// </summary>
+        /// <param name="Yes">鏄惁鏄剧ず鍒锋柊鍥炬爣</param>
         void SeachMusic(bool Yes = false)
         {
             for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
@@ -181,8 +197,9 @@
                                 a31player.IsEnd = false;
                             }
                             MusicListView(a31player);
-                            A31MusicModel.ReadMusicStates();
                         }
+                       //A31MusicModel.ReadMusicStates();
+
                     });
                     return;
                 }
@@ -192,7 +209,7 @@
                     //涓嶆槸鎴戜滑鏀寔鐨勫搧鐗屼笉鏀寔
                     if (obj.Name != null)
                     {
-                        obj.sid = "00010112345678901234561A1A230123AABB" + obj.UniqueDeviceName;
+                        obj.sid = "030101123456781A1A230123AABB" + obj.UniqueDeviceName;
                         A31MusicModel.A31MusicModelList.Add(obj);
                     }
                 }
@@ -217,7 +234,6 @@
             musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
             musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
             musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
-
             if (a31player.IsEnd)
             {
                 musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
@@ -255,7 +271,7 @@
             {
                 if (a31player.ServerClientType == 0)
                 {
-                    new View.DialogView { }.PlayMergence();
+                    new View.DialogView { }.PlayMergence(a31player);
                 }
                 else if (a31player.ServerClientType == 1)
                 {
@@ -277,6 +293,10 @@
             };
             musicView.musicIfonFl.MouseUpEventHandler += clickPlayView;
             musicView.clickBtn.MouseUpEventHandler += clickPlayView;//
+            musicView.singerBtn.MouseUpEventHandler += clickPlayView;
+            musicView.songNameBtn.MouseUpEventHandler += clickPlayView;//
+            musicView.musicNameBtn.MouseUpEventHandler += clickPlayView;
+            musicView.regionBtn.MouseUpEventHandler += clickPlayView;//
 
             ///涓婁竴鏇茬偣鍑讳簨浠�
             musicView.prevBtn.MouseDownEventHandler += (sender, e) =>
@@ -324,7 +344,7 @@
                     {
                         continue;
                     }
-                    //SendMethod.ReadStatus(a31player);
+                    SendMethod.ReadStatus(a31player);
                     Application.RunOnMainThread(() =>
                     {
                         musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
@@ -366,10 +386,8 @@
             })
             { IsBackground = true, Name = "A31" };
             musicThread.Start();
-            //threadLists.Add(musicThread);
+            threadLists.Add(musicThread);
         }
-        
-
         /// <summary>
         /// 璇诲彇涓讳粠鍏崇郴
         /// </summary>
@@ -427,7 +445,7 @@
                                 {
                                     A31MusicModel.A31MusicModelList.Add(new A31MusicModel
                                     {
-                                        sid = "00010112345678901234561A1A230123AABB" + slave.uuid.Replace("uuid:", ""),
+                                        sid = "030101123456781A1A230123AABB" + slave.uuid.Replace("uuid:", ""),
                                         ServerClientType = -1,//浠庣殑
                                         IPAddress = slave.ip,
                                         MainPlayIP = a31player.IPAddress,

--
Gitblit v1.8.0