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

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs |  135 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 108 insertions(+), 27 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
index a883705..0e7b6ff 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
@@ -10,11 +10,23 @@
         /// <summary>
         /// 涓荤獥浣�
         /// </summary>
-        FrameLayout bodyView;
+        public static ArmCenterPage bodyView;
         /// <summary>
         /// 鑷畾涔夊竷闃插尯鍩�
         /// </summary>
         HorizontalScrolViewLayout customDeploymentView;
+
+        //瀹夐槻鐘舵�佽儗鏅浘
+        Button btnArmTipIcon;
+        /// <summary>
+        /// 褰撳墠甯冮槻鍚嶇О
+        /// </summary>
+        Button btnDefenseName;
+
+        /// <summary>
+        /// 鎾ら槻鍖哄煙
+        /// </summary>
+        FrameLayout disarmView;
 
         public ArmCenterPage()
         {
@@ -43,16 +55,33 @@
                 Height =Application.GetRealWidth(32),
             });
 
-            //瀹夐槻鐘舵�佽儗鏅浘
-            Button btnArmTipIcon = new Button()
+            FrameLayout alarmIconBgView = new FrameLayout()
             {
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(198),
                 Height = Application.GetRealWidth(198),
+            };
+            contentView.AddChidren(alarmIconBgView);
+
+            btnArmTipIcon = new Button()
+            {
+                //Gravity = Gravity.CenterHorizontal,
+                //Width = Application.GetRealWidth(198),
+                //Height = Application.GetRealWidth(198),
                 UnSelectedImagePath = "FunctionIcon/ArmCenter/NoDefenseBigIcon.png",
                 SelectedImagePath = "FunctionIcon/ArmCenter/InDefenseBigIcon.png",
             };
-            contentView.AddChidren(btnArmTipIcon);
+            alarmIconBgView.AddChidren(btnArmTipIcon);
+
+            btnDefenseName = new Button()
+            {
+                Y = Application.GetRealWidth(117),
+                Height = Application.GetRealHeight(81),
+                TextAlignment = TextAlignment.Center,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor =  CSS_Color.MainBackgroundColor,
+            };
+            alarmIconBgView.AddChidren(btnDefenseName);
 
             contentView.AddChidren(new Button()
             {
@@ -61,34 +90,42 @@
 
 
             #region 鎾ら槻鍖哄煙
-            var disarmView = new FrameLayout()
+            Button btnDisarm;
+            disarmView = new FrameLayout()
             {
                 Height = 0,
             };
             contentView.AddChidren(disarmView);
 
-            var btnDisarm = new Button()
+            btnDisarm = new Button()
             {
-                Width = Application.GetRealWidth(120),
-                Height = Application.GetRealHeight(44),
-                BackgroundColor = CSS_Color.WarningColor,
+                Y = Application.GetRealHeight(10),
+                Width = Application.GetRealWidth(148),
+                Height = Application.GetRealHeight(40),
+                BackgroundColor = CSS_Color.MainColor,
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.MainBackgroundColor,
-                Text = "鎾ら槻"
+                Text = "鎾ら槻",
+                Radius = (uint)Application.GetRealWidth(20),
+                Gravity = Gravity.CenterHorizontal,
             };
             disarmView.AddChidren(btnDisarm);
             btnDisarm.MouseUpEventHandler = (sender, e) => {
-                if (SecurityCenter.Security.CurrentDefenseMode != null)
+                foreach (var temp in FunctionList.List.securities)
                 {
-                    Control.Ins.ControlSecurity(SecurityCenter.Security.CurrentDefenseMode, "disable");
+                    if (temp.status == "enable")
+                    {
+                        Control.Ins.ControlSecurity(temp, "disable");
+                        break;
+                    }
                 }
             };
 
-            #endregion
+                #endregion
 
-            #region 鑷畾涔夊竷闃�
-            //鑷畾涔夊竷闃叉爣棰�
-            Button btnCustomDeploymentTitle = new Button()
+                #region 鑷畾涔夊竷闃�
+                //鑷畾涔夊竷闃叉爣棰�
+                Button btnCustomDeploymentTitle = new Button()
             {
                 X = Application.GetRealWidth(24),
                 Height = Application.GetRealWidth(54),
@@ -107,8 +144,6 @@
                 ScrollEnabled = false,
             };
             contentView.AddChidren(customDeploymentView);
-
-            iniCustomDeploymentView();
 
 
             #endregion
@@ -184,8 +219,8 @@
 
 
 
-
-
+            ///鍒锋柊鐣岄潰
+            LoadEvent_RefreshSecurityStatus();
 
         }
 
@@ -198,14 +233,18 @@
 
             foreach (var mode in FunctionList.List.securities)
             {
-                var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png",
+                var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png",
                 mode.name);
                 customDeploymentView.AddChidren(armDiyView);
                 EventHandler<MouseEventArgs> event2 = (sender, e) =>
-                        {
-                            ShowArmDialog(mode);
-                        };
+                {
+                    ShowArmDialog(mode);
+                };
                 armDiyView.SetClickEvent(event2);
+                if (mode.status == "enable")
+                {
+                    armDiyView.LightingView(true);
+                }
             }
 
             if (FunctionList.List.securities.Count < 4)
@@ -293,8 +332,20 @@
 
             dialog.Show();
 
+            if(alarm.status == "enable")
+            {
+                btnOpen.TextColor = CSS_Color.PromptingColor1;
+                btnOpen.Text = Language.StringByID(StringId.AlreadyOpened).Trim() ;
+            }
+
             btnOpen.MouseUpEventHandler = (sender, e) => {
-                Control.Ins.ControlSecurity(alarm,  "enable");  
+                if (alarm.status == "disable")
+                {
+                    Control.Ins.ControlSecurity(alarm, "enable");
+                }else
+                {
+                    Control.Ins.ControlSecurity(alarm, "disable");
+                }
                 dialog.Close();  
             };
 
@@ -305,7 +356,7 @@
                 {
                     iniCustomDeploymentView();
                 };
-                var armSetPage = new ArmDeploymentSettingPage(alarm,refreshAction);
+                var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction);
                 MainPage.BasePageView.AddChidren(armSetPage);
                 armSetPage.LoadPage();
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -318,7 +369,29 @@
 
         }
 
-
+        public static void LoadEvent_RefreshSecurityStatus()
+        {
+            Application.RunOnMainThread(() =>
+            {
+                if (bodyView != null)
+                {
+                    bodyView.iniCustomDeploymentView();
+                    bodyView.disarmView.Height = 0;
+                    bodyView.btnArmTipIcon.IsSelected = false;
+                    bodyView.btnDefenseName.Text = "";
+                    foreach (var temp in FunctionList.List.securities)
+                    {
+                        if (temp.status == "enable")
+                        {
+                            bodyView.disarmView.Height = Application.GetRealHeight(68);
+                            bodyView.btnArmTipIcon.IsSelected = true;
+                            bodyView.btnDefenseName.Text = temp.name;
+                            break;
+                        }
+                    }
+                }
+            });
+        }
     }
 
 
@@ -369,6 +442,14 @@
             btnText.MouseUpEventHandler = eventHandler;
         }
 
+        /// <summary>
+        /// 鐐逛寒鍖哄煙
+        /// </summary>
+        public void LightingView(bool seleted)
+        {
+            btnIcon.IsSelected = seleted;
+        }
+
 
     }
 

--
Gitblit v1.8.0