From 6129e717a8b3265e9b35ac5823f7c95fd306da04 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 26 一月 2024 17:17:16 +0800
Subject: [PATCH] 修复可视对讲无法收到推送的问题,传感器无法动态获取等级的问题

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |   69 +++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 2f82535..9e31a22 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Reflection;
 using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
@@ -348,8 +349,8 @@
         /// </summary>
         void LoadSensorDiv(Function sensor,int index)
         {
-            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
-            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
+            var levelColorList = sensorTemp.GetLevelColorList(sensor);
+            var levelTextList = sensorTemp.GetLevelTextList(sensor);
             {
                 var sensorTag = sensor.spk + sensor.sid + sensor.deviceId;
                 FrameLayout sensorView = new FrameLayout()
@@ -511,8 +512,8 @@
                 }
                 else
                 {
-                    btnLevel.TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1];
-                    btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1];
+                    btnLevel.Text = levelTextList[sensorTemp.GetCurLevel(sensor) - 1];
+                    btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor)[sensorTemp.GetCurLevel(sensor) - 1];
                     btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value);
                 }
             }
@@ -524,34 +525,34 @@
         void LoadInfo(Function sensor)
         {
             List<uint> levelColorList = new List<uint>();
-            List<int> levelTextList = new List<int>();
-            List<string> levelText = new List<string>();
+            List<string> levelTextList = new List<string>();
+            //List<string> levelText = new List<string>();
             List<string> intervalList = new List<string>();
             var configs = sensor.GetAttrKeyConfigs(sensor.SpkClassification);
 
 
-            int i = 0;
-            foreach(var info in configs)
+            //int i = 0;
+            //foreach(var info in configs)
+            //{
+            //    foreach(var config in info.configs)
+            //    {
+            //        var color = Convert.ToUInt32(config.color,16);
+            //        var text = config.desc;
+            //        levelColorList.Add(color);
+            //        //levelText.Add(text);
+            //        levelTextList.Add(i++);
+            //        intervalList.Add(config.start + " ~ " + config.end);
+            //    }
+            //}
+            //if (levelColorList.Count == 0)
             {
-                foreach(var config in info.configs)
-                {
-                    var color = Convert.ToUInt32(config.color,16);
-                    var text = config.desc;
-                    levelColorList.Add(color);
-                    levelText.Add(text);
-                    levelTextList.Add(i++);
-                }
-            }
-            if (levelColorList.Count == 0)
-            {
-                levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
-                levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
-                intervalList = sensorTemp.GetIntervalValue(sensor.spk);
-
-                foreach (var iii in levelTextList)
-                {
-                    levelText.Add(Language.StringByID(iii));
-                }
+                levelColorList = sensorTemp.GetLevelColorList(sensor);
+                levelTextList = sensorTemp.GetLevelTextList(sensor);
+                intervalList = sensorTemp.GetIntervalValue(sensor);
+                //foreach (var iii in levelTextList)
+                //{
+                //    levelText.Add(Language.StringByID(iii));
+                //}
             }
             Dialog dialog = new Dialog();
 
@@ -650,7 +651,7 @@
             });
             try
             {
-                for (int index = 0; index < levelText.Count; index++)
+                for (int index = 0; index < levelTextList.Count; index++)
                 {
                     //if(sensorTemp.GetIntervalValue(sensor.spk).Count >= index)
                     //{
@@ -678,7 +679,7 @@
                         TextColor = CSS_Color.FirstLevelTitleColor,
                         TextSize = CSS_FontSize.TextFontSize,
                         IsBold = true,
-                        Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
+                        Text = intervalList[index]
                     });
 
                     subInfoView.AddChidren(new Button()
@@ -689,7 +690,7 @@
                         TextColor = CSS_Color.FirstLevelTitleColor,
                         TextSize = CSS_FontSize.TextFontSize,
                         IsBold = true,
-                        Text = levelText[index]
+                        Text = levelTextList[index]
                     });
 
                     subInfoView.AddChidren(new Button()
@@ -967,17 +968,17 @@
                                             {
                                                 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];
+                                                    (btn as Button).Text = bodyView.sensorTemp.GetLevelTextList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                                    (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
                                                 }
                                             }
                                         }
                                     }
                                     else if (btn.GetType() == typeof(ArcSeekBar))
                                     {
-                                        (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                        (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
 
-                                        (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
+                                        (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
                                     }
                                 }
                             }

--
Gitblit v1.8.0