From 26355a896c2469ec65d425f48efcf450c6df904a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 22 三月 2021 09:11:49 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr

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

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
new file mode 100644
index 0000000..95a465b
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -0,0 +1,134 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
+{
+
+    public class SetPir : FrameLayout
+    {
+        public SetPir()
+        {
+            Tag = "PirMain";
+        }
+
+        public void Show(Action 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;
+            FrameLayout viewLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(64),
+                Width = Application.GetRealWidth(Intelligence.Automation.LogicView.TextSize.view375),
+                Height = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 64 - 76),
+                BackgroundColor = CSS.CSS_Color.viewMiddle,
+            };
+            this.AddChidren(viewLayout);
+            ///鍚嶇О
+            FrameLayout50 editNameFLayout = new FrameLayout50();
+            editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
+            editNameFLayout.btnEditText.Text = Pir.currPir.name;
+            editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28);
+            editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
+            editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
+            viewLayout.AddChidren(editNameFLayout.FLayoutView());
+            ///鐗堟湰鍗囩骇
+            FrameLayout50 banbenshengjiFL = new FrameLayout50();
+            banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji);
+            banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
+            viewLayout.AddChidren(banbenshengjiFL.FLayoutView());
+            ///鐗堟湰鍙�:v1.3.5
+            FrameLayout50 banbenhaoFLayout = new FrameLayout50();
+            banbenhaoFLayout.btnNextIcon.Visible = false;
+            banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":v1.3.5";
+            banbenhaoFLayout.frameLayout.Y = banbenshengjiFL.frameLayout.Bottom;
+            viewLayout.AddChidren(banbenhaoFLayout.FLayoutView());
+            //鍒犻櫎
+            FrameLayout frameLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 50),
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = CSS.CSS_Color.view,
+                Gravity = Gravity.BottomCenter,//缃簳鐨勫睘鎬�
+            };
+            this.AddChidren(frameLayout);
+            Button btnDel = new Button
+            {
+                TextSize = Intelligence.Automation.LogicView.TextSize.text16,
+                Width = Application.GetRealWidth(50),
+                Height = Application.GetRealHeight(22),
+                TextColor = CSS.CSS_Color.textRedColor,
+                Gravity = Gravity.Center,
+                TextID = StringId.Del,
+            };
+            frameLayout.AddChidren(btnDel);
+            #endregion
+            #region  鐣岄潰鐐瑰嚮浜嬩欢
+            //淇敼鍚嶇О鐨勭偣鍑讳簨浠�
+            editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+                List<string> list = new List<string>();
+                Method method = new Method();
+                method.EditControlName(StringId.editName, list, Pir.currPir.name, (name, dialog) =>
+                {
+                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) =>
+                    {
+                        dialog.Close();
+                        editNameFLayout.btnEditText.Text = name;
+                        Pir.currPir.name = name;
+
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
+
+                }, () => { });
+            };
+            //鍒犻櫎绾㈠瀹濈殑鐐瑰嚮浜嬩欢
+            EventHandler<MouseEventArgs> delClick = (sender, e) =>
+            {
+                string text = Language.StringByID(StringId.shanchushebei) + Pir.currPir.name + "?";
+                TipPopView tipPopView = new TipPopView();
+                tipPopView.TipBox(StringId.tip, text, (dialog) =>
+                {
+
+                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) =>
+                    {
+                        var pir = Pir.pirDeviceList.Find((c) => c.deviceId == Pir.currPir.deviceId);
+                        if (pir != null)
+                        {
+                            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();
+                            }
+                        }
+                    }, "鍒犻櫎", "dialog", null, dialog);
+
+                }, () =>
+                {
+                }, false);
+
+
+            };
+            btnDel.MouseUpEventHandler += delClick;
+            frameLayout.MouseUpEventHandler += delClick;
+            #endregion
+
+        }
+
+    }
+}

--
Gitblit v1.8.0