From 132ef8524e38d06da8cf74292a3ac1eff065bb1b Mon Sep 17 00:00:00 2001
From: tzy <274116637@qq.com>
Date: 星期二, 23 三月 2021 16:38:01 +0800
Subject: [PATCH] 整好新风的UI,待真实设备测试

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs |   68 +++++++++++++++++++++++++++++----
 1 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index ac1b20d..801b039 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -8,10 +8,24 @@
     {
         public AddControlComplete()
         {
-            Tag = "Pir";
+            Tag = "PirView";
         }
         public void Show(Control control, bool bool_library)
         {
+            //鏁版嵁杞崲
+            Entity.Function function = new Entity.Function();
+            {
+                function.sid = control.sid;
+                function.deviceId = control.deviceId;
+                function.name = control.name;
+                function.spk = control.spk;
+                //function.attributes.AddRange(control.status);
+                //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛�
+                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
+                {
+                    Pir.currPir.FunctioList.Add(function);
+                }
+            }
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
@@ -51,7 +65,7 @@
                 TextAlignment = TextAlignment.Center,
             };
             fLayout.AddChidren(text1Btn);
-            //鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤
+            //鍙埌鍒嗙被-鍔熻兘-鎿嶄綔浣跨敤
             Button text2Btn = new Button
             {
                 Width = Application.GetRealWidth(375 - 32),
@@ -76,12 +90,13 @@
             this.AddChidren(namePatchView.FLayoutView());
             namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
             namePatchView.btnText2.Text = control.name;
+          
             //鎵�灞炲尯鍩�
             View.PatchView quyuPatchView = new View.PatchView();
             quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
             this.AddChidren(quyuPatchView.FLayoutView());
             quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
-            quyuPatchView.btnText2.TextID = StringId.dianqi;
+            quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
 
             //缁х画娣诲姞
             Button addBtn = new Button
@@ -103,9 +118,36 @@
             #endregion
             #region  鐣岄潰鐐瑰嚮浜嬩欢
             //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
-            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
+            namePatchView.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+
+                List<string> list = new List<string>();
+                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
+                {
+                    list.Add(Pir.currPir.FunctioList[i].name);
+                }
+                Method method = new Method();
+                method.EditControlName(StringId.editName, list, control.name, (name, dialog) =>
+                {
+                    Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
+                    {
+                        dialog.Close();
+                        namePatchView.btnText2.Text = name;
+                        function.name = name;
+
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
+                }, () => { });
+            };
             //鎵�灞炲尯鍩熺偣鍑讳簨浠�
-            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
+            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+                Method method = new Method();
+                method.ManagementPosition(function, () =>
+                {
+                    //鏇存柊鍖哄煙
+                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
+                });
+            };
             //缁х画娣诲姞鐐瑰嚮浜嬩欢
             addBtn.MouseUpEventHandler += (sender, e) =>
             {
@@ -116,10 +158,10 @@
                 else
                 {
                     Method method = new Method();
-                    method.AddControl(this, (control1) => {
+                    method.AddControl(this, (controlDevice) => { 
                         AddButton addButton = new AddButton();
                         MainPage.BasePageView.AddChidren(addButton);
-                        addButton.Show(control1);
+                        addButton.Show(controlDevice);
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     });
                 }
@@ -127,8 +169,16 @@
             //瀹屾垚鐐瑰嚮浜嬩欢
             saveView.btnClick.MouseUpEventHandler += (sender, e) =>
             {
-                MainPage.BasePageView.RemoveViewByTag("AddControl");
-                MainPage.BasePageView.RemoveViewByTag("Pir");
+                //绉婚櫎鎵�鏈夌晫闈�
+                MainPage.BasePageView.RemoveViewByTag("PirView");
+                //绉婚櫎绾㈠瀹濇牴鐣岄潰
+                MainPage.BasePageView.RemoveViewByTag("PirMain");
+                //閲嶆柊鍔犺浇鐣岄潰
+                var page = new PirMain();
+                MainPage.BasePageView.AddChidren(page);
+                page.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
             };
             #endregion
         }

--
Gitblit v1.8.0