From 557c8c4f75aafc97533721766272410042440d34 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期六, 21 八月 2021 11:00:29 +0800
Subject: [PATCH] 安防功能

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs |  119 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 95 insertions(+), 24 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
index 6ab343a..a883705 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
@@ -10,6 +11,11 @@
         /// 涓荤獥浣�
         /// </summary>
         FrameLayout bodyView;
+        /// <summary>
+        /// 鑷畾涔夊竷闃插尯鍩�
+        /// </summary>
+        HorizontalScrolViewLayout customDeploymentView;
+
         public ArmCenterPage()
         {
             bodyView = this;
@@ -53,6 +59,33 @@
                 Height = Application.GetRealWidth(16),
             });
 
+
+            #region 鎾ら槻鍖哄煙
+            var disarmView = new FrameLayout()
+            {
+                Height = 0,
+            };
+            contentView.AddChidren(disarmView);
+
+            var btnDisarm = new Button()
+            {
+                Width = Application.GetRealWidth(120),
+                Height = Application.GetRealHeight(44),
+                BackgroundColor = CSS_Color.WarningColor,
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.MainBackgroundColor,
+                Text = "鎾ら槻"
+            };
+            disarmView.AddChidren(btnDisarm);
+            btnDisarm.MouseUpEventHandler = (sender, e) => {
+                if (SecurityCenter.Security.CurrentDefenseMode != null)
+                {
+                    Control.Ins.ControlSecurity(SecurityCenter.Security.CurrentDefenseMode, "disable");
+                }
+            };
+
+            #endregion
+
             #region 鑷畾涔夊竷闃�
             //鑷畾涔夊竷闃叉爣棰�
             Button btnCustomDeploymentTitle = new Button()
@@ -67,7 +100,7 @@
             };
             contentView.AddChidren(btnCustomDeploymentTitle);
 
-            HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout()
+            customDeploymentView = new HorizontalScrolViewLayout()
             {
                 X = Application.GetRealWidth(23),
                 Height = Application.GetRealWidth(80),
@@ -75,28 +108,9 @@
             };
             contentView.AddChidren(customDeploymentView);
 
-            //customDeploymentView.AddChidren(new Button()
-            //{
-            //    Width = Application.GetRealWidth(23),
-            //});
-            var view = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png",
-                Language.StringByID(StringId.HouseDefense));
-            customDeploymentView.AddChidren(view);
-            EventHandler<MouseEventArgs> event1 = (sender, e) =>
-            {
-               ShowArmDialog(new SecurityAlarm());
-            };
-            view.SetClickEvent(event1);
-            
+            iniCustomDeploymentView();
 
-            if(FunctionList.List.securities.Count>3)
-            {
-                customDeploymentView.ScrollEnabled = true;
-            }
 
-            foreach (var mode in FunctionList.List.securities)
-            {
-            }
             #endregion
 
             contentView.AddChidren(new Button()
@@ -104,6 +118,8 @@
                 Height = Application.GetRealHeight(20),
             });
 
+            #region 鍥哄畾甯冮槻鍖哄煙
+            /*
             var fixedDeploymentView = new FrameLayout()
             {
                 Height = Application.GetRealHeight(133),
@@ -134,7 +150,6 @@
             };
             fixedDeploymentView.AddChidren(btnFixedDeploymentTip);
 
-            //鍥哄畾甯冮槻鍖哄煙
             var fixedDeploymentTypeView = new HorizontalScrolViewLayout()
             {
                 Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15),
@@ -148,7 +163,7 @@
                 Width = Application.GetRealWidth(24),
             });
 
-
+            #endregion
 
 
             //鐏惧鎶ヨ
@@ -163,10 +178,57 @@
             //闃茬洍鎶ヨ
             var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute));
             fixedDeploymentTypeView.AddChidren(burglarAlarmView);
+            */
+            #endregion
+
+
+
+
+
+
 
         }
 
+        /// <summary>
+        /// 鍒濆鍖栬嚜瀹氫箟甯冮槻鍖哄煙
+        /// </summary>
+        private void iniCustomDeploymentView()
+        {
+            customDeploymentView.RemoveAll();
 
+            foreach (var mode in FunctionList.List.securities)
+            {
+                var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png",
+                mode.name);
+                customDeploymentView.AddChidren(armDiyView);
+                EventHandler<MouseEventArgs> event2 = (sender, e) =>
+                        {
+                            ShowArmDialog(mode);
+                        };
+                armDiyView.SetClickEvent(event2);
+            }
+
+            if (FunctionList.List.securities.Count < 4)
+            {
+                var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png",
+                  Language.StringByID(StringId.Custom));
+                customDeploymentView.AddChidren(view);
+                EventHandler<MouseEventArgs> event1 = (sender, e) =>
+                {
+                    Action refreshAction = () =>
+                    {
+                        iniCustomDeploymentView();
+                    };
+
+                    var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), refreshAction);
+                    MainPage.BasePageView.AddChidren(addDefensePage);
+                    addDefensePage.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                };
+                view.SetClickEvent(event1);
+            }
+
+        }
 
         private void ShowArmDialog(SecurityAlarm alarm)
         {
@@ -231,10 +293,19 @@
 
             dialog.Show();
 
+            btnOpen.MouseUpEventHandler = (sender, e) => {
+                Control.Ins.ControlSecurity(alarm,  "enable");  
+                dialog.Close();  
+            };
+
 
             btnCheckModify.MouseUpEventHandler = (sender, e) => {
                 dialog.Close();
-                var armSetPage = new ArmDeploymentSettingPage(alarm);
+                Action refreshAction = () =>
+                {
+                    iniCustomDeploymentView();
+                };
+                var armSetPage = new ArmDeploymentSettingPage(alarm,refreshAction);
                 MainPage.BasePageView.AddChidren(armSetPage);
                 armSetPage.LoadPage();
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;

--
Gitblit v1.8.0