From e322d91c7325019710bfdb046c5fea673031455a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 29 七月 2020 11:53:01 +0800
Subject: [PATCH] 20200729

---
 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs |  118 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 99 insertions(+), 19 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
index d845d8d..35d5e30 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
@@ -1,8 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
-using System.Text;
-using HDL_ON.Entity;
 using Shared;
+using HDL_ON.Entity;
 
 namespace HDL_ON.UI.Music
 {
@@ -15,8 +14,60 @@
         static A31MusicModel()
         {
             Refresh();
-            //Type = DeviceType.A31MusicModel;
         }
+
+        static List<System.Threading.Thread> updataMusicStatesListThread = new List<System.Threading.Thread>();
+
+        /// <summary>
+        /// 璇诲彇闊充箰鐘舵��
+        /// </summary>
+        public static void ReadMusicStates()
+        {
+
+            var threads = updataMusicStatesListThread.FindAll((obj) => { return obj.Name == "A31"; });
+            for (int i =0;i< updataMusicStatesListThread.Count;)
+            {
+                try
+                {
+                    var thread = updataMusicStatesListThread[i];
+                    if (thread.IsAlive)
+                    {
+                        thread.Abort();
+                    }
+                    updataMusicStatesListThread.Remove(thread);
+                }
+                catch (Exception e)
+                {
+                    MainPage.Log("clearA31Threads error : " + e.Message);
+                }
+                finally
+                {
+                    MainPage.Log("clearA31Threads over");
+                }
+            }
+
+            for (int i = 0; i < A31MusicModelList.Count; i++)
+            {
+                var a31player = A31MusicModelList[i];
+                var musicThread = new System.Threading.Thread(() =>
+                {
+                    while (true)
+                    {
+                        System.Threading.Thread.Sleep(1000);
+                        if (!a31player.IsOnLine)
+                        {
+                            continue;
+                        }
+                        //A31MusicModel.ReadMusicStates();
+                        SendMethod.ReadStatus(a31player);
+                    }
+                })
+                { IsBackground = true, Name = "A31" };
+                musicThread.Start();
+                updataMusicStatesListThread.Add(musicThread);
+            }
+        }
+
         /// <summary>
         ///淇濆瓨褰撳墠闊充箰鍒楄〃
         /// </summary>
@@ -47,7 +98,7 @@
         /// <summary>
         /// 闊充箰鎾斁鍣ㄥ悕绉�
         /// </summary>
-        public string Name=string.Empty;
+        public string Name = string.Empty;
         /// <summary>
         /// 涓婁竴娆℃洿鏂扮殑鏃堕棿
         /// 璁板綍鏁版嵁鍙嶉鐨勬椂闂�(鍥犱负鏈夋椂闂寸綉缁滃樊鏁版嵁涓嶅洖澶嶏紝瀵艰嚧鍒锋柊褰撳墠鎾斁闊充箰鏃堕棿涓嶆纭�)
@@ -67,12 +118,15 @@
         /// <summary>
         /// 鏄惁鏄挱鏀惧櫒鍒楄〃鏈�鍚庝竴涓�(true)
         /// </summary>
-        public bool IsEnd=false;
+        public bool IsEnd = false;
 
         public int A31DeviceType;
 
         //public string a31Source = "wifi";
         //public string a31Source = string.Empty;
+        /// <summary>
+        /// 闊充箰鎾斁鍣↖D
+        /// </summary>
         public string UniqueDeviceName = string.Empty;
 
         /// <summary>
@@ -129,7 +183,7 @@
         /// <summary>
         /// usb鍒楄〃
         /// </summary>
-        public List<MusicInfo> USBList= new List<MusicInfo>();
+        public List<MusicInfo> USBList = new List<MusicInfo>();
         /// <summary>
         /// Tidal鍠滅埍鍒楄〃
         /// </summary>
@@ -137,24 +191,59 @@
         /// <summary>
         ///鍒涘缓闊充箰鏂囦欢鍒楄〃
         /// </summary>
-        public List<FileListInfo> FileLists= new List<FileListInfo>();
+        public List<FileListInfo> FileLists = new List<FileListInfo>();
         /// <summary>
         /// 褰撳墠鐨凙31闊充箰鎾斁鍣�
         /// </summary>
         public static A31MusicModel Current;
 
+        public int _ServerClientType;
         /// <summary>
         /// -1琛ㄧず浠庣殑0琛ㄧず榛樿1琛ㄧず涓荤殑
         /// </summary>
-        public int ServerClientType;
+        public int ServerClientType
+        {
+            get
+            {
+                return _ServerClientType;
+            }
+            set
+            {
+                _ServerClientType = value;
+                if(value == 0)
+                {
+                    name = Name;
+                }
+            }
+        }
         /// <summary>
         /// 璁板綍涓绘挱鏀惧櫒IP
         /// </summary>
         public string MainPlayIP = string.Empty;
+
+        public string _MainPlayName = string.Empty;
         /// <summary>
         /// 璁板綍涓绘挱鏀惧櫒鍚嶇О
         /// </summary>
-        public string MainPlayName = string.Empty;
+        public string MainPlayName
+        {
+            get
+            {
+                return _MainPlayName;
+            }
+            set
+            {
+                _MainPlayName = value;
+                if(ServerClientType == 1)
+                {
+                    name = value;
+                }
+            }
+        }
+        /// <summary>
+        /// 璁板綍涓绘挱鏀惧櫒鏄惁琚敹钘�
+        /// </summary>
+        public bool MainPlayCollection = false;
 
         public Slaves Slave = new Slaves();
 
@@ -178,12 +267,6 @@
                 return false;
             }
         }
-
-
-        #region 缁勫悎灞炴��
-
-
-        #endregion
 
     }
     [System.Serializable]
@@ -228,7 +311,4 @@
         public string version = string.Empty;
         public string uuid = string.Empty;
     }
-
-
-
-}
+}
\ No newline at end of file

--
Gitblit v1.8.0