From 08a8afe782cd499550f94f3da0ba5788e1e12971 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 02 三月 2021 17:45:45 +0800
Subject: [PATCH] 2021-3-2-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs |   97 ++++++++++++++----------------------------------
 1 files changed, 29 insertions(+), 68 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index ce82452..f462d97 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -11,20 +11,20 @@
         /// <summary>
         /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶
         /// </summary>
-        public void AddControl()
+        public void AddControl(FrameLayout frameLayout)
         {
             View.TipView tipView = new View.TipView();
-            tipView.InputBox("", (s, dialog) =>
+            tipView.InputBox(frameLayout,"", (name, frame) => 
             {
                 ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁
                 Pir.BuottonList.Clear();
-                if (!string.IsNullOrEmpty(s))
+                if (!string.IsNullOrEmpty(name))
                 {
                     Control control = new Control();
-                    control.name = s;
+                    control.name = name;
                     control.type = "learn";
 
-                    ThreadAddControl(control, dialog);
+                    ThreadAddControl(control, frame,false);
 
 
 
@@ -36,18 +36,18 @@
         /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶
         /// </summary>
         /// <param name="control"></param>
-        /// <param name="dialog"></param>
-        public void ThreadAddControl(Control control, Dialog dialog) {
+        /// <param name="frame"></param>
+        public void ThreadAddControl(Control control, FrameLayout frame,bool bool_library) {  
 
             DAL.Server.ResponsePackNew responsePackNew = null;
             Loading loading = new Loading();
-            dialog.AddChidren(loading);
+            frame.AddChidren(loading);
             loading.Start();
             new System.Threading.Thread(() =>
             {
                 try
                 {
-                    responsePackNew = PirSend.Add(control);
+                    responsePackNew = PirSend.Add(control, bool_library);
                 }
                 catch { }
                 finally
@@ -59,11 +59,23 @@
                         //{
                         if (!string.IsNullOrEmpty(Sid("sid"))) { }
                         ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
-                        dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥
-                        AddButton addButton = new AddButton();
-                        MainPage.BasePageView.AddChidren(addButton);
-                        addButton.Show(control);
-                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥
+                        if (bool_library) {
+                            MainPage.BasePageView.RemoveViewByTag("PirView");
+                            AddControlComplete addControlComplete = new AddControlComplete();
+                            MainPage.BasePageView.AddChidren(addControlComplete);
+                            addControlComplete.Show(control, bool_library);
+                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        }
+                        else
+                        {
+
+                           
+                            AddButton addButton = new AddButton();
+                            MainPage.BasePageView.AddChidren(addButton);
+                            addButton.Show(control);
+                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        }
 
                         //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
                         //View.FailView failView = new View.FailView();
@@ -82,32 +94,7 @@
             { IsBackground = true }.Start();
 
         }
-
-        public  List<DD> GetLsit(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str)
-        {
-            List<DD> list = new List<DD>();
-            ResponsePackNew responsePackNew = null;
-           PirSend.GetDeviceTypesList(frameLayout, action, id, if_str);
-
-            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];
-                    var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                    list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DD>>(str);
-                   
-
-                }
-            }
-            else
-            {
-                Method method = new Method();
-                method.ErrorShow(responsePackNew);
-            }
-            return list;
-        }
+      
         /// <summary>
         /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�)
         /// </summary>
@@ -148,33 +135,7 @@
 
             }
         }
-        [Serializable]
-        public class DD
-        {
-            /// <summary>
-            /// 璁惧绫诲瀷涓婚敭Id
-            /// </summary>
-            public string id=string.Empty;
-            /// <summary>
-            /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...)
-            /// </summary>
-            public string deviceType = string.Empty;
-            /// <summary>
-            ///鍝佺墝鍚嶇О
-            /// </summary>
-            public string brandName = string.Empty;
-            /// <summary>
-            /// 绾㈠鐮�
-            /// </summary>
-            public string irCode = string.Empty;
-            /// <summary>
-            /// 鍝佺墝涓婚敭Id
-            /// </summary>
-            public string brandId = string.Empty;
-            /// <summary>
-            /// 绾㈠鐮佺储寮曞簭鍙�
-            /// </summary>
-            public string irIndex = string.Empty;
-        }
+       
     }
+  
 }

--
Gitblit v1.8.0