From 203c3a3ffde6259413d9743f6a723b95b1e7989c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 06 七月 2023 22:43:05 +0800
Subject: [PATCH] 门锁功能

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |  134 +++++++++++++++++++++++++++++---------------
 1 files changed, 88 insertions(+), 46 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index ea27379..58cfe45 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -274,7 +274,11 @@
             int index = 0;
             foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
             {
-                if(SPK.EvironmentSensorList().Contains(sensor.spk))
+                if (sensor.spk == SPK.SensorPm10)
+                {
+                    continue;
+                }
+                if(SPK.EvironmentSensorList().Contains(sensor.spk) )
                 {
                     foreach (var seTemp in sensor.attributes)
                     {
@@ -488,8 +492,36 @@
         /// </summary>
         void LoadInfo(Function sensor)
         {
-            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
-            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
+            List<uint> levelColorList = new List<uint>();
+            List<int> levelTextList = new List<int>();
+            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)
+            {
+                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));
+                }
+            }
             Dialog dialog = new Dialog();
 
             FrameLayout dialogBodyView = new FrameLayout();
@@ -525,7 +557,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)";
@@ -582,55 +614,65 @@
                 IsBold = true,
                 TextID = StringId.ColorValue,
             });
-            for (int index = 0; index < levelTextList.Count; index++)
+            try
             {
-                infoView.AddChidren(new Button()
+                for (int index = 0; index < levelText.Count; index++)
                 {
-                    Gravity = Gravity.CenterHorizontal,
-                    Width = Application.GetRealWidth(303),
-                    Height = Application.GetRealWidth(1),
-                    BackgroundColor = CSS_Color.DividingLineColor,
-                });
+                    //if(sensorTemp.GetIntervalValue(sensor.spk).Count >= index)
+                    //{
+                    //    return;
+                    //}
+                    infoView.AddChidren(new Button()
+                    {
+                        Gravity = Gravity.CenterHorizontal,
+                        Width = Application.GetRealWidth(303),
+                        Height = Application.GetRealWidth(1),
+                        BackgroundColor = CSS_Color.DividingLineColor,
+                    });
 
-                FrameLayout subInfoView = new FrameLayout()
-                {
-                    Height = Application.GetRealHeight(44),
-                };
-                infoView.AddChidren(subInfoView);
+                    FrameLayout subInfoView = new FrameLayout()
+                    {
+                        Height = Application.GetRealHeight(44),
+                    };
+                    infoView.AddChidren(subInfoView);
 
-                subInfoView.AddChidren(new Button()
-                {
-                    X = Application.GetRealWidth(20),
-                    Width = Application.GetRealWidth(100),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    IsBold = true,
-                    Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
-                });
+                    subInfoView.AddChidren(new Button()
+                    {
+                        X = Application.GetRealWidth(20),
+                        Width = Application.GetRealWidth(100),
+                        TextAlignment = TextAlignment.CenterLeft,
+                        TextColor = CSS_Color.FirstLevelTitleColor,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        IsBold = true,
+                        Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
+                    });
 
-                subInfoView.AddChidren(new Button()
-                {
-                    Gravity = Gravity.CenterHorizontal,
-                    Width = Application.GetRealWidth(100),
-                    TextAlignment = TextAlignment.Center,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    IsBold = true,
-                    TextID = levelTextList[index]
-                });
+                    subInfoView.AddChidren(new Button()
+                    {
+                        Gravity = Gravity.CenterHorizontal,
+                        Width = Application.GetRealWidth(100),
+                        TextAlignment = TextAlignment.Center,
+                        TextColor = CSS_Color.FirstLevelTitleColor,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        IsBold = true,
+                        Text = levelText[index]
+                    });
 
-                subInfoView.AddChidren(new Button()
-                {
-                    X = Application.GetRealWidth(285),
-                    Gravity = Gravity.CenterVertical,
-                    Width = Application.GetRealWidth(38),
-                    Height = Application.GetRealHeight(18),
-                    Radius = (uint)Application.GetRealWidth(4),
-                    BackgroundColor = levelColorList[index]
-                });
+                    subInfoView.AddChidren(new Button()
+                    {
+                        X = Application.GetRealWidth(285),
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetRealWidth(38),
+                        Height = Application.GetRealHeight(18),
+                        Radius = (uint)Application.GetRealWidth(4),
+                        BackgroundColor = levelColorList[index]
+                    });
+                }
             }
-
+            catch (Exception ex)
+            {
+                MainPage.Log($"鐜绛夌骇淇℃伅琛ㄥ姞杞藉紓甯�:{ex.Message}");
+            }
 
 
 

--
Gitblit v1.8.0