From af954b34ffad38c3b11bd82caa54d5fb0c36e6ec Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期三, 13 十二月 2023 16:19:12 +0800
Subject: [PATCH] 2023年12月13日16:18:38

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |   76 ++++++++++++++++++++++++++++++++-----
 1 files changed, 65 insertions(+), 11 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 147501a..0309210 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -91,7 +91,7 @@
                 TextAlignment = TextAlignment.CenterLeft,
                 TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                 TextColor = CSS_Color.FirstLevelTitleColor,
-                Text = MainPage.cityInfo.location,
+                Text = MainPage.cityInfo.city,
             };
             topWeatherView.AddChidren(btnLocationText);
 
@@ -392,6 +392,10 @@
                         imagePath = "FunctionIcon/EnvirSensor/HchoBg.png";
                         iconPath = "FunctionIcon/EnvirSensor/HchoIcon.png";
                         break;
+                    case SPK.SensorLight:
+                        imagePath = "FunctionIcon/EnvirSensor/IlluminationBg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/IlluminationIcon.png";
+                        break;
                 }
                 sensorView.BackgroundImagePath = imagePath;
 
@@ -413,6 +417,10 @@
 
                 btnIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -432,6 +440,10 @@
                 sensorView.AddChidren(btnInfoIcon);
                 btnInfoIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     LoadInfo(sensor);
                 };
 
@@ -442,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);
@@ -476,6 +490,11 @@
                 sensorView.AddChidren(btnSensorValues);
                 btnSensorValues.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
+                    
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -483,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);
+                }
             }
         }
 
@@ -557,7 +587,7 @@
             switch (sensor.spk)
             {
                 case SPK.SensorPm25:
-                    btnTitle.Text = "PM2.5(ug/m虏)";
+                    btnTitle.Text = "PM2.5(ug/m鲁)";//虏
                     break;
                 case SPK.SensorTemperature:
                     btnTitle.Text = Language.StringByID(StringId.Temp) + "(掳C)";
@@ -805,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
 
@@ -857,6 +903,7 @@
                             }
                         }
 
+                        Console.WriteLine(updateTemp.spk);
                         for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
                         {
                             var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId;
@@ -875,9 +922,9 @@
                                         if (btn.Tag != null)
                                         {
                                             FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value);
-                                            if(attr == null)
+                                            if (attr == null)
                                             {
-                                                switch(updateTemp.spk)
+                                                switch (updateTemp.spk)
                                                 {
                                                     case SPK.SensorCO2:
                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2);
@@ -897,6 +944,10 @@
                                                     case SPK.SensorHumidity:
                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
                                                         break;
+                                                    case SPK.SensorLight:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Illuminance);
+                                                        break;
+
                                                 }
                                             }
 
@@ -907,8 +958,11 @@
                                             }
                                             else if (tag == "SensorLevel")
                                             {
-                                                (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
-                                                (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                                if (updateTemp.spk != SPK.SensorLight)
+                                                {
+                                                    (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                                    (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                                }
                                             }
                                         }
                                     }

--
Gitblit v1.8.0