From cda2410f9c29f2fadc16e9de38ccae95b75a89dd Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 09 六月 2021 10:51:13 +0800
Subject: [PATCH] 1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
index ab952eb..6d9da0c 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -10,19 +10,16 @@
     {
         public SetPir()
         {
-            Tag = "PirMain";
+            Tag = "PirView";
         }
-        Action backAction;
-        public void Show(Action action)
+        public void Show()
         {
-            backAction = action;
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView();
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
             {
-                //action();
                 RemoveFromParent();
             };
             topView.topNameBtn.TextID = StringId.setlogic;
@@ -84,10 +81,10 @@
             editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 List<string> list = new List<string>();
-                Method method = new Method();
+                PirMethod method = new PirMethod();
                 method.EditControlName(StringId.editName, list, Pir.currPir.name, (name, dialog) =>
                 {
-                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) =>
+                    PirMethod.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) =>
                     {
                         dialog.Close();
                         editNameFLayout.btnEditText.Text = name;
@@ -105,7 +102,7 @@
                 tipPopView.TipBox(StringId.tip, text, (dialog) =>
                 {
 
-                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) =>
+                    PirMethod.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) =>
                     {
                         var pir = Pir.pirDeviceList.Find((c) => c.deviceId == Pir.currPir.deviceId);
                         if (pir != null)
@@ -113,16 +110,8 @@
                             Pir.pirDeviceList.Remove(Pir.currPir);
                         }
                         dialog.Close();
-                        action();
                         this.RemoveFromParent();
-                        for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
-                        {
-                            var view = MainPage.BasePageView.GetChildren(i);
-                            if (view.GetType() == typeof(PirMain))
-                            {
-                                view.RemoveFromParent();
-                            }
-                        }
+                        PirMethod.RemoveView("PirMain");
                     }, "鍒犻櫎", "dialog", null, dialog);
 
                 }, () =>
@@ -141,8 +130,10 @@
         /// </summary>
         public override void RemoveFromParent()
         {
-            backAction();
+            //鍒锋柊PirMain鐣岄潰
+            PirMethod.RefreshView("PirMain");
             base.RemoveFromParent();
+          
         }
     }
 }

--
Gitblit v1.8.0