From 1cba5ec1959f9012c66f96254afb3206904ff671 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 25 三月 2021 13:27:01 +0800
Subject: [PATCH] 2021-3-25-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs |  127 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 120 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index 9236d52..f5f2ed2 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,13 +8,13 @@
 {
     public class Method
     {
-       
+
         /// <summary>
         /// 绾㈠瀹濈▼搴忎富鍏ュ彛
         /// </summary>
         /// <param name="frame"></param>
         /// <param name="function"></param>
-        public void MainView(FrameLayout frame, Entity.Function function,Action action)
+        public void MainView(FrameLayout frame, Entity.Function function, Action action)
         {
             Pir pirDevice = new Pir();
             if (function != null)
@@ -37,6 +37,7 @@
                     PirMain.BackAction += () =>
                     {
                         action?.Invoke();
+                        PirMain.BackAction = null;
                     };
                 });
             }, Pir.currPir);
@@ -142,7 +143,13 @@
                             {
                                 if (device != null)
                                 {
+
                                     control.deviceId = device.deviceId;
+                                    //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛�
+                                    if (null == Pir.currPir.FunctioList.Find((c) => c.deviceId == device.deviceId))
+                                    {
+                                        Pir.currPir.FunctioList.Add(device);
+                                    }
                                     frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥
                                     action(control);
                                 }
@@ -246,7 +253,7 @@
                             {
                                 loading.Hide();
                                 Method method = new Method();
-                                method.ErrorShow(null,"璇诲彇绾㈠瀹濆垪琛ㄥけ璐�");
+                                method.ErrorShow(null, "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�");
                             }
                         }
                         catch { }
@@ -365,9 +372,10 @@
         /// <param name="view">鍒ゆ柇log鐖舵帶浠�</param>
         /// <param name="frame">log鐖舵帶浠�</param>
         /// <param name="dialog">log鐖舵帶浠�</param>
-        public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog)
+        /// <param name="attributesStatus">瀛︿範鎸夐敭</param>
+        public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, Entity.AttributesStatus attributesStatus=null)
         {
-           
+
             //鍔犺浇log
             Loading loading = new Loading();
             if (view == "dialog")
@@ -395,7 +403,10 @@
                     }
                     else if (str == "鍒犻櫎鎸夐敭")
                     {
-                        // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
+                        if (attributesStatus != null)
+                        {
+                            responsePackNew = PirSend.CodeRemove(attributesStatus, control.deviceId);
+                        }
                     }
                     else if (str == "鑾峰彇璁惧璇︽儏")
                     {
@@ -405,6 +416,10 @@
                     else if (str == "鑾峰彇閬ユ帶鍣ㄥ垪琛�")
                     {
                         responsePackNew = PirSend.ControlList(control.deviceId);
+                    }
+                    else if (str == "搴撶爜娴嬭瘯")
+                    {
+                        responsePackNew = PirSend.CodeTest(control);
                     }
                 }
                 catch { }
@@ -420,7 +435,28 @@
                         else
                         {
                             Method method = new Method();
-                            method.ErrorShow(responsePackNew, "");
+                            //鑷畾涔夐敊璇彁绀烘枃鏈�
+                            string eorroText = "";
+                            if (str == "鍒犻櫎")
+                            {
+                            }
+                            else if (str == "淇敼鍚嶇О")
+                            {
+
+                            }
+                            else if (str == "鍒犻櫎鎸夐敭")
+                            {
+                            }
+                            else if (str == "鑾峰彇璁惧璇︽儏")
+                            {
+                            }
+                            else if (str == "鑾峰彇閬ユ帶鍣ㄥ垪琛�")
+                            {
+                            }
+                            else if (str == "搴撶爜娴嬭瘯")
+                            {
+                            }
+                            method.ErrorShow(responsePackNew, eorroText);
                         }
 
                     });
@@ -504,6 +540,10 @@
             {
                 str = Language.StringByID(StringId.huoqushujushibao);
             }
+            else if (text == "娣诲姞澶辫触")
+            {
+                str = Language.StringByID(StringId.tianjiashibai);
+            }
             else
             {
                 if (responsePackNew != null)
@@ -550,6 +590,79 @@
                 case 3: { } break;
             }
         }
+        /// <summary>
+        ///鎸囧畾鍒锋柊鐣岄潰
+        /// </summary>
+        /// <param name="strView">鍒ゆ柇瀛楃</param>
+        public static void RefreshView(string strView)
+        {
+            //鏍囪鏄笉鏄凡缁忓埛鏂板畬鎴�
+            bool if_bool = false;
+            for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
+            {
+                var view = MainPage.BasePageView.GetChildren(i);
+                if (strView == "PirMain")
+                {
+                    if (view.GetType() == typeof(PirMain))
+                    {
+                        //寮哄埗杞崲瀵硅薄
+                        var f = (PirMain)view;
+                        //绉婚櫎鎵�鏈夊瓙鎺т欢
+                        f.RemoveAll();
+                        //閲嶆柊鍔犺浇UI
+                        f.Show();
+                        //閫�鍑篺or寰幆
+                        //break;
+                        if_bool = true;
+                    }
+                }
+                if (if_bool)
+                {
+                    //閫�鍑篺or寰幆
+                    break;
+                }
+            }
+        }
+        /// <summary>
+        /// 鎸囧畾鍒犻櫎鐣岄潰
+        /// </summary>
+        /// <param name="strView">鍒ゆ柇瀛楃</param>
+        public static void RemoveView(string strView)
+        {
+
+            for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
+            {
+                var view = MainPage.BasePageView.GetChildren(i);
+                if (strView == "PirMain")
+                {
+                    if (view.GetType() == typeof(PirMain))
+                    {
+                        //绉婚櫎鐣岄潰
+                        view.RemoveFromParent();
+                    }
+
+                }
+                else if (strView == "AddControl")
+                {
+
+                    if (view.GetType() == typeof(AddControl))
+                    {
+                        //鎵惧埌绉婚櫎
+                        view.RemoveFromParent();
+                    }
+                }
+                else if (strView == "AddControlComplete")
+                {
+
+                    if (view.GetType() == typeof(AddControlComplete))
+                    {
+                        //鎵惧埌绉婚櫎
+                        view.RemoveFromParent();
+                    }
+                }
+
+            }
+        }
 
     }
     [Serializable]

--
Gitblit v1.8.0