From f26d7b01a57fdb53dbe58ad355e3c45e3ec06d60 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 26 二月 2021 16:14:02 +0800
Subject: [PATCH] 2021-2-26-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs |   73 ++++++++++++++++++++++++++++--------
 1 files changed, 57 insertions(+), 16 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
index 4835344..97af281 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -9,9 +9,9 @@
     {
         public AddControl()
         {
-            Tag = "AddControl";
+            Tag = "Pir";
         }
-        public void Show()
+        public void Show(Control control)
         {
 
             #region 鐣岄潰甯冨眬
@@ -24,8 +24,7 @@
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
-                //杩斿洖娓呯┖鍒楄〃
-                Pir.BuottonList.Clear();
+                
                 this.RemoveFromParent();
 
             };
@@ -135,19 +134,27 @@
             {
                 AddButton addButton = new AddButton();
                 MainPage.BasePageView.AddChidren(addButton);
-                addButton.Show();
+                addButton.Show(control);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             //淇濆瓨鐐瑰嚮浜嬩欢
             saveBtn.MouseUpEventHandler += (sender, e) =>
             {
-                //淇濆瓨閬ユ帶鍣ㄦ竻闄や箣鍓嶆寜閽垪琛ㄧ殑鏁版嵁
-                Pir.BuottonList.Clear();
+               //绉婚櫎褰撳墠鐣岄潰
+                this.RemoveFromParent();
                 //鍙兘涔嬪墠宸茬粡瀛樺湪璇ョ晫闈�
-                MainPage.BasePageView.RemoveViewByTag("Pir");
+                for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
+                {
+                    var view = MainPage.BasePageView.GetChildren(i);
+                    if (view.GetType() == typeof(AddControlComplete))
+                    {
+                        view.RemoveFromParent();
+                    }
+                }
+                //MainPage.BasePageView.RemoveViewByTag("Pir");
                 AddControlComplete addControlComplete = new AddControlComplete();
                 MainPage.BasePageView.AddChidren(addControlComplete);
-                addControlComplete.Show();
+                addControlComplete.Show(control);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             #endregion
@@ -207,7 +214,7 @@
                     X = Application.GetRealWidth((16 + 92) + (104 + 16) * j),
                     Width = Application.GetRealWidth(16),
                     Height = Application.GetRealWidth(16),
-                    Tag = nameObj.value,
+                    Tag = nameObj,
                 };
                 if (if_bool)
                 {
@@ -216,13 +223,47 @@
                 //鍒犻櫎鍥炬爣鐨勭偣鍑讳簨浠�
                 delIconBtn.MouseUpEventHandler += (sender, e) =>
                 {
-                    var name = delIconBtn.Tag.ToString();
-                    var buttonObj = Pir.BuottonList.Find((c) => c.value == name);
-                    if (buttonObj != null)
+                    var obj = delIconBtn.Tag as ButtonObj;
+                    //鍔犺浇log
+                    Loading loading = new Loading();
+                    this.AddChidren(loading);
+                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                    loading.Start();
+                    new System.Threading.Thread(() =>
                     {
-                        Pir.BuottonList.Remove(buttonObj);
-                    }
-                    RefreshView(vv, true);
+                        try
+                        {
+                            //鍙戦�佹寜閿垹闄わ紱
+                            responsePackNew = PirSend.CodeRemove(obj);
+                        }
+                        catch { }
+                        finally
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                loading.Hide();
+                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                {
+                                    ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
+                                    var buttonObj = Pir.BuottonList.Find((c) => c.value == obj.value);
+                                    if (buttonObj != null)
+                                    {
+                                        Pir.BuottonList.Remove(buttonObj);
+                                    }
+                                    RefreshView(vv, true);
+                                }
+                                else {
+                                    Method method = new Method();
+                                    method.ErrorShow(responsePackNew);
+                                }
+
+                            });
+                        }
+
+                    })
+                    { IsBackground = true }.Start();
+
+
                 };
                 if (i % 3 == 0)
                 {

--
Gitblit v1.8.0