mac
2024-07-25 16bea1d248f0010049bceaa562939297fa26b130
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -1,5 +1,6 @@
using 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();
@@ -597,7 +598,7 @@
                    btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)";
                    break;
                case SPK.SensorTVOC:
                    btnTitle.Text = "TVOC(PPB)";
                    btnTitle.Text = "TVOC(mg/m³)";
                    break;
                case SPK.SensorCO2:
                    btnTitle.Text = "CO2(PPM)";
@@ -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);
                                    }
                                }
                            }