From 3f45dd0172305bef0008e4e5a8725dedec2340c9 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 21 四月 2022 10:28:21 +0800
Subject: [PATCH] 紧急求助按钮备份

---
 HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs |   83 ++++++++++++++++++++++++++++++++---------
 1 files changed, 64 insertions(+), 19 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
index 436d5f9..de866dd 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
@@ -1,7 +1,6 @@
 锘縰sing System;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
-using HDL_ON.UI.Music;
 using Shared;
 
 namespace HDL_ON.UI
@@ -9,7 +8,7 @@
     public partial class FunctionControlZone : FrameLayout
     {
         #region 鍖哄煙鎺т欢
-        static FrameLayout bodyDiv;
+        FunctionControlZone bodyDiv;
         /// <summary>
         /// 鍔熻兘/鍦烘櫙icon
         /// </summary>
@@ -26,6 +25,11 @@
         /// 鏀惰棌鎸夐挳
         /// </summary>
         Button btnCollectionIcon;
+        /// <summary>
+        /// 绂荤嚎鏂囨湰
+        /// </summary>
+        Button btnOffline;
+
         #endregion
 
         #region 鍖哄煙鍙橀噺
@@ -50,6 +54,7 @@
 
         /// <summary>
         /// 鍔犺浇鍔熻兘绫诲瀷鎺у埗鍗$墖
+        /// Tag 鍔熻兘灞炴�ф樉绀�
         /// </summary>
         public void LoadFunctionDiv()
         {
@@ -61,8 +66,8 @@
             }
             LoadDiv();
 
-         
-                btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png";
+
+            btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png";
             
             if (SPK.CurtainSpkList().Contains(function.spk))
             {//绐楀笜娌℃湁寮�鍏虫寜閽�
@@ -95,6 +100,46 @@
             else if (function.spk == SPK.DoorLock)
             {
                 btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png";
+            }
+            else if(SPK.PanelSpkList().Contains(function.spk))//鏅鸿兘闈㈡澘璁惧
+            {
+                var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState);
+                if (powerLowTipAttr != null)
+                {
+                    if (powerLowTipAttr.state.ToLower() == "low")
+                    {
+                        Button btnTipPowerLow = new Button()
+                        {
+                            X = Application.GetRealWidth(307),
+                            Y = Application.GetRealHeight(70),
+                            Width = Application.GetRealWidth(24),
+                            Height = Application.GetRealWidth(24),
+                            UnSelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png",
+                            SelectedImagePath = "FunctionIcon/ArmSensor/PowerLowIcon.png",
+                        };
+                        this.AddChidren(btnTipPowerLow);
+                    }
+                }
+                var alarmStatusAttr = function.GetAttribute("alarm_status");
+                if(alarmStatusAttr !=null)
+                {
+                    var btnAlarmStatus = new Button()
+                    {
+                        X = Application.GetRealWidth(8 + 10 + 32),
+                        Y = Application.GetRealHeight(53),
+                        Width = Application.GetRealWidth(200),
+                        Height = Application.GetRealHeight(24),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+                        Tag = "AlarmStatus"
+                    };
+                    if(alarmStatusAttr.state == "alarm")
+                    {
+                        btnAlarmStatus.TextID = StringId.InAlarm;
+                        btnAlarmStatus.TextColor = CSS_Color.WarningColor;
+                    }
+                    bodyDiv.AddChidren(btnAlarmStatus);
+                }
             }
             else
             {
@@ -226,21 +271,21 @@
                 bodyDiv.AddChidren(btnCollectionIcon);
             }
 
-            if (!function.online)
-            {
-                bodyDiv.BackgroundColor = CSS_Color.PromptingColor2;
-                var btnOffline = new Button()
-                {
-                    X = Application.GetRealWidth(8 + 10 + 32),
-                    Y = Application.GetRealHeight(28 + 24),
-                    Height = Application.GetRealHeight(30),
-                    TextID = StringId.DeviceOffline,
-                    TextColor = CSS_Color.WarningColor,
-                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                    TextAlignment = TextAlignment.CenterLeft
-                };
-                bodyDiv.AddChidren(btnOffline);
-            }
+            //if (!function.online)
+            //{
+            //    bodyDiv.BackgroundColor = CSS_Color.PromptingColor2;
+            //    btnOffline = new Button()
+            //    {
+            //        X = Application.GetRealWidth(8 + 10 + 32),
+            //        Y = Application.GetRealHeight(28 + 24),
+            //        Height = Application.GetRealHeight(30),
+            //        TextID = StringId.DeviceOffline,
+            //        TextColor = CSS_Color.WarningColor,
+            //        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //        TextAlignment = TextAlignment.CenterLeft
+            //    };
+            //    bodyDiv.AddChidren(btnOffline);
+            //}
         }
 
         /// <summary>

--
Gitblit v1.8.0