From 22288c2816f39348316a961806dc41bbe0ab6822 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 08 一月 2024 09:40:01 +0800
Subject: [PATCH] V2.4.3 bug fixed

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |   89 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 71 insertions(+), 18 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 2ba2c67..2f82535 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);
 
@@ -274,10 +274,7 @@
             int index = 0;
             foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
             {
-                if (sensor.spk == SPK.SensorPm10)
-                {
-                    continue;
-                }
+               
                 if(SPK.EvironmentSensorList().Contains(sensor.spk) )
                 {
                     foreach (var seTemp in sensor.attributes)
@@ -351,10 +348,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);
             {
@@ -379,6 +372,10 @@
                     case SPK.SensorPm25:
                         imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png";
                         iconPath = "FunctionIcon/EnvirSensor/Pm25Icon.png";
+                        break;
+                    case SPK.SensorPm10:
+                        imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/Pm10Icon.png";
                         break;
                     case SPK.SensorTVOC:
                         imagePath = "FunctionIcon/EnvirSensor/TvocBg.png";
@@ -421,6 +418,10 @@
 
                 btnIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -440,6 +441,10 @@
                 sensorView.AddChidren(btnInfoIcon);
                 btnInfoIcon.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
                     LoadInfo(sensor);
                 };
 
@@ -450,15 +455,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 +491,11 @@
                 sensorView.AddChidren(btnSensorValues);
                 btnSensorValues.MouseUpEventHandler = (sender, e) =>
                 {
+                    if (!IsSupportClick(sensor))
+                    {
+                        return;
+                    }
+                    
                     #region 
                     var esp = new EnvironmentalSensorPage(sensor);
                     MainPage.BasePageView.AddChidren(esp);
@@ -491,7 +503,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);
+                }
             }
         }
 
@@ -566,6 +589,9 @@
             {
                 case SPK.SensorPm25:
                     btnTitle.Text = "PM2.5(ug/m鲁)";//虏
+                    break;
+                case SPK.SensorPm10:
+                    btnTitle.Text = "PM10(ug/m鲁)";//虏
                     break;
                 case SPK.SensorTemperature:
                     btnTitle.Text = Language.StringByID(StringId.Temp) + "(掳C)";
@@ -813,8 +839,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
 
@@ -865,6 +907,7 @@
                             }
                         }
 
+                        Console.WriteLine(updateTemp.spk);
                         for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
                         {
                             var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId;
@@ -883,12 +926,15 @@
                                         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);
+                                                        break;
+                                                    case SPK.SensorPm10:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm10);
                                                         break;
                                                     case SPK.SensorTemperature:
                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature);
@@ -905,6 +951,10 @@
                                                     case SPK.SensorHumidity:
                                                         attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
                                                         break;
+                                                    case SPK.SensorLight:
+                                                        attr = updateTemp.GetAttribute(FunctionAttributeKey.Illuminance);
+                                                        break;
+
                                                 }
                                             }
 
@@ -915,8 +965,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