From ba9e028d73bab5b7a0f000d11b39460d2b57707a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 19 三月 2021 18:07:10 +0800
Subject: [PATCH] 2021-3-19-2

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs |   59 +++++++++++++++++------------------------------------------
 1 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
index b5140c1..87b8d69 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -10,10 +10,9 @@
         public EditControl()
         {
         }
-
-        public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action)
+        public void Show(Entity.Function control,Action<Entity.Function> action)
         {
-
+            #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
             topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
@@ -32,7 +31,7 @@
                 BackgroundColor = CSS.CSS_Color.viewMiddle,
             };
             this.AddChidren(viewLayout);
-
+            //閬ユ帶鍣ㄥ悕绉�:
             FrameLayout50 editNameFLayout = new FrameLayout50(); 
             editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
             editNameFLayout.btnEditText.Text = control.name;
@@ -40,62 +39,37 @@
             editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
             editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
             viewLayout.AddChidren(editNameFLayout.FLayoutView());
-
+            //閬ユ帶鍣ㄦ墍灞炲尯鍩�:
             FrameLayout50 areaFLayout = new FrameLayout50(); 
             areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu);
             areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
             areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
             viewLayout.AddChidren(areaFLayout.FLayoutView());
-
+            #endregion
+            #region
+            //淇敼鍚嶇О鐐瑰嚮浜嬩欢
             editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 List<string> list = new List<string>();
 
-                for (int i = 0; i < pir.FunctioList.Count; i++)
+                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                 {
-                    list.Add(pir.FunctioList[i].name);
+                    list.Add(Pir.currPir.FunctioList[i].name);
                 }
                 Method method = new Method();
-                method.EditControlName(StringId.editName,list, control.name, (name,view) =>
+                method.EditControlName(StringId.editName,list, control.name, (name, dialog) =>
                 {
-                    //鍔犺浇log
-                    Loading loading = new Loading();
-                    view.AddChidren(loading);
-                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                    loading.Start();
-                    new System.Threading.Thread(() =>
+                    Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
                     {
-                        try
-                        {
-                            responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
-                        }
-                        catch { }
-                        finally
-                        {
-                            Application.RunOnMainThread(() =>
-                            {
-                                loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                {
-                                    view.Close();
-                                    editNameFLayout.btnEditText.Text = name;
-                                    control.name = name;
-                                }
-                                else
-                                {
-                                    Method methodError = new Method(); 
-                                    methodError.ErrorShow(responsePackNew,"");
-                                }
+                        dialog.Close();
+                        editNameFLayout.btnEditText.Text = name;
+                        control.name = name;
 
-                            });
-                        }
-
-                    })
-                    { IsBackground = true }.Start();
-
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
                    
                 },()=> { });
             };
+            //閬ユ帶鍣ㄦ墍灞炲尯鍩熼�変腑浜嬩欢
             areaFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 Method method = new Method();
@@ -105,6 +79,7 @@
                     areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
                 });
             };
+            #endregion
         }
     }
 }

--
Gitblit v1.8.0