From 25ce81434a6ce69cf10f12d4f5a25ab80a339ba7 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 03 三月 2021 17:50:53 +0800
Subject: [PATCH] 2021-3-3-3

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs |   58 +++++++++++++++++++++++++---------------------------------
 1 files changed, 25 insertions(+), 33 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index f462d97..0790aa6 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -11,7 +11,7 @@
         /// <summary>
         /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶
         /// </summary>
-        public void AddControl(FrameLayout frameLayout)
+        public void AddControl(FrameLayout frameLayout,Action<Control> action)
         {
             View.TipView tipView = new View.TipView();
             tipView.InputBox(frameLayout,"", (name, frame) => 
@@ -24,7 +24,7 @@
                     control.name = name;
                     control.type = "learn";
 
-                    ThreadAddControl(control, frame,false);
+                    ThreadAddControl(control, frame, action);
 
 
 
@@ -37,7 +37,7 @@
         /// </summary>
         /// <param name="control"></param>
         /// <param name="frame"></param>
-        public void ThreadAddControl(Control control, FrameLayout frame,bool bool_library) {  
+        public void ThreadAddControl(Control control, FrameLayout frame,Action<Control> action) {  
 
             DAL.Server.ResponsePackNew responsePackNew = null;
             Loading loading = new Loading();
@@ -47,7 +47,7 @@
             {
                 try
                 {
-                    responsePackNew = PirSend.Add(control, bool_library);
+                    responsePackNew = PirSend.Add(control);
                 }
                 catch { }
                 finally
@@ -55,39 +55,31 @@
                     Application.RunOnMainThread(() =>
                     {
                         loading.Hide();
-                        //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        //{
-                        if (!string.IsNullOrEmpty(Sid("sid"))) { }
-                        ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
-                        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;
+                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                    {
+                            if (!string.IsNullOrEmpty(Sid("sid")))
+                            {
+                                //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
+                                View.FailView failView = new View.FailView();
+                                failView.ShouError((view) =>
+                                {
+                                    view.Close();
+                                    ThreadAddControl(control, frame, action);
+                                });
+                            }
+                            else
+                            {
+                                ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
+                                frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥
+                                action(control);
+                            }
+
+                            
                         }
                         else
                         {
-
-                           
-                            AddButton addButton = new AddButton();
-                            MainPage.BasePageView.AddChidren(addButton);
-                            addButton.Show(control);
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                            ErrorShow(responsePackNew);
                         }
-
-                        //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
-                        //View.FailView failView = new View.FailView();
-                        //failView.ShouError((view) => {
-                        //    view.Close();
-                        //    ThreadAddControl(control, dialog);
-                        //});
-                        //}
-                        //else
-                        //{
-                        //    ErrorShow(responsePackNew);
-                        //}
                     });
                 }
             })

--
Gitblit v1.8.0