From ec59aaadfc049de2ca1eccca6e30998fd2828755 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 04 九月 2023 09:55:15 +0800
Subject: [PATCH] 2023年09月04日09:54:39

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |   56 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 2ba2c67..e6f5b27 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -351,10 +351,6 @@
         /// </summary>
         void LoadSensorDiv(Function sensor,int index)
         {
-            if (sensor.spk==SPK.SensorLight) {
-                //鍏堣繃婊ゆ帀鍏夌収浼犳劅鍣�
-                return;
-            }
             var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
             var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
             {
@@ -421,6 +417,10 @@
 
                 btnIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -440,6 +440,10 @@
                 sensorView.AddChidren(btnInfoIcon);
                 btnInfoIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     LoadInfo(sensor);
                 };
 
@@ -450,15 +454,17 @@
                     Width = Application.GetRealWidth(100),
                     Height = Application.GetRealWidth(32),
                     TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1],
                     TextSize = CSS_FontSize.SubheadingFontSize,
-                    TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
                     Tag = "SensorLevel",
                 };
                 sensorView.AddChidren(btnLevel);
 
                 btnLevel.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -484,6 +490,11 @@
                 sensorView.AddChidren(btnSensorValues);
                 btnSensorValues.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
+                    
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -491,7 +502,18 @@
                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     #endregion
                 };
-
+                if (!IsSupportClick(sensor))
+                {
+                    btnLevel.TextID = StringId.guangzhao;
+                    btnLevel.TextColor = 0xFF1B2D4D;
+                    btnSensorValues.Text = sensor.GetAttrState("illuminance");
+                }
+                else
+                {
+                    btnLevel.TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1];
+                    btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1];
+                    btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value);
+                }
             }
         }
 
@@ -813,8 +835,24 @@
         }
 
 
-
-
+        /// <summary>
+        /// 鏄惁鏀寔浜嬩欢
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        bool IsSupportClick(Function device)
+        {
+            if (device == null)
+            {
+                return false;
+            }
+            if (device.spk == SPK.SensorLight)
+            {
+                //鍏堣繃婊ゆ帀鍏夌収浼犳劅鍣�
+                return false;
+            }
+            return true;
+        }
 
         #region event
 

--
Gitblit v1.8.0