From bd2c6c39668f2495d14440ae2d6bb7a7856e9d2f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 12 三月 2021 17:47:57 +0800
Subject: [PATCH] 2021-3-12-3

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs |  151 ++++++++++++++++++--------------------------------
 1 files changed, 55 insertions(+), 96 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index 840df69..d0745a8 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -28,12 +28,12 @@
         /// <param name="list">褰撳墠瀛樺湪鍚嶇О鍒楄〃</param>
         /// <param name="currName">褰撳墠鍚嶇О</param>
         /// <param name="action">鍥炶皟鍑芥暟</param>
-        public void EditControlName(int tipText ,List<string> list, string currName, Action<string, Dialog> action,Action actionCancel, bool tag=false)
+        public void EditControlName(int tipText, List<string> list, string currName, Action<string, Dialog> action, Action actionCancel, bool tag = false)
         {
             new View.TipView().InputBox(tipText, currName, StringId.nameNull, StringId.NameAlreadyExists, list, (text, view
                 ) =>
             {
-                action(text,view);
+                action(text, view);
             }, () => { actionCancel(); }, tag);
         }
         /// <summary>
@@ -190,8 +190,6 @@
                             }
 
                         }
-                        //GetControlList(frame, action);
-                       // GetControlList();
 
                     }
                 }
@@ -200,20 +198,22 @@
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        loading.Hide();
-                       
-                       // action();
                         try
                         {
                             if (Pir.pirDeviceList.Count != 0)
                             {
-                                GetControlList1(frame, action);
-                                var list = Pir.pirDeviceList;
+                                GetControlList(() =>
+                                {
+                                    loading.Hide();
+                                    action();
+
+                                });
                             }
                             else
                             {
-                                //Method method = new Method();
-                                //method.ErrorShow(responsePackNew);
+                                loading.Hide();
+                                Method method = new Method();
+                                method.ErrorShow(null,"璇诲彇绾㈠瀹濆垪琛ㄥけ璐�");
                             }
                         }
                         catch { }
@@ -228,60 +228,10 @@
         /// <summary>
         /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
         /// </summary>
-        public static void GetControlList()
-        {
-
-            new System.Threading.Thread(() =>
-            {
-
-                for (int i = 0; i < Pir.pirDeviceList.Count; i++)
-                {
-                    var pirDevice = Pir.pirDeviceList[i];
-                    try
-                    {
-                        var responsePackNew = PirSend.ControlList(pirDevice);
-                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        {
-                            var jArray = JArray.Parse(responsePackNew.Data.ToString());
-                            for (int a = 0; a < jArray.Count; a++)
-                            {
-                                var jay = jArray[a];
-                                //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
-                                if (pirJosn != null)
-                                {
-                                    if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
-                                    {
-                                        pirDevice.FunctioList.Add(pirJosn);
-                                    }
-                                }
-
-                            }
-                        }
-
-                    }
-                    catch { }
-
-                }
-
-
-            })
-            { IsBackground = true }.Start();
-
-        }
-        /// <summary>
-        /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
-        /// </summary>
-        /// <param name="frame">log鍥炬爣鍔犺浇鐣岄潰</param>
         /// <param name="action">鍥炶皟鍑芥暟</param>
-        public static void GetControlList1(FrameLayout frame, Action action)
+        public static void GetControlList(Action action)
         {
-            //鍔犺浇log
-            Loading loading = new Loading();
-            frame.AddChidren(loading);
-            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-            loading.Start();
+
             new System.Threading.Thread(() =>
             {
                 try
@@ -291,52 +241,42 @@
                         var pirDevice = Pir.pirDeviceList[i];
                         try
                         {
-                            responsePackNew = PirSend.ControlList(pirDevice);
+                            var responsePackNew = PirSend.ControlList(pirDevice);
+                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                            {
+                                var jArray = JArray.Parse(responsePackNew.Data.ToString());
+                                for (int a = 0; a < jArray.Count; a++)
+                                {
+                                    var jay = jArray[a];
+                                    //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
+                                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                                    var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
+                                    if (pirJosn != null)
+                                    {
+                                        if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
+                                        {
+                                            pirDevice.FunctioList.Add(pirJosn);
+                                        }
+                                    }
+
+                                }
+                            }
 
                         }
                         catch { }
-                        finally
-                        {
-                            Application.RunOnMainThread(() =>
-                            {
-                                try
-                                {
-                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                    {
-                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
-                                        for (int a = 0; a < jArray.Count; a++)
-                                        {
-                                            var jay = jArray[a];
-                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                            var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
-                                            if (pirJosn != null)
-                                            {
-                                                if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
-                                                {
-                                                    pirDevice.FunctioList.Add(pirJosn);
-                                                }
-                                            }
 
-                                        }
-                                    }
-                                   
-                                }
-                                catch { }
-
-                            });
-                        }
                     }
                 }
                 catch { }
                 finally
                 {
+
                     Application.RunOnMainThread(() =>
                     {
-                        loading.Hide();
                         action();
                     });
                 }
+
             })
             { IsBackground = true }.Start();
 
@@ -379,6 +319,22 @@
             })
             { IsBackground = true }.Start();
         }
+        /// <summary>
+        /// 鍙戦�佸懡浠ょ嚎绋�
+        /// </summary>
+        /// <param name="control">鍙戦�佹暟鎹璞�</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        /// <param name="str">鍒ゆ柇瀛楃</param>
+        /// <param name="frame">log鐖舵帶浠�</param>
+        /// <param name="dialog">log鐖舵帶浠�</param>
+        public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog)
+        {
+
+
+
+        }
+
+
         /// <summary>
         /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁
         /// </summary>
@@ -426,11 +382,14 @@
         /// </summary>
         /// <param name="responsePackNew"></param>
         /// <param name="str"></param>
-        public void ErrorShow(ResponsePackNew responsePackNew, string str = "")
+        public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "")
         {
             if (str == "鍒犻櫎閬ユ帶鍣�")
             {
                 new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
+            } else if (str == "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�") {
+
+                new Intelligence.Automation.LogicView.TipPopView().FlashingBox("璇诲彇绾㈠瀹濆垪琛ㄥけ璐�");
             }
             else
             {

--
Gitblit v1.8.0