mac
2024-07-25 16bea1d248f0010049bceaa562939297fa26b130
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs
@@ -497,7 +497,7 @@
                                {
                                    if (view.Tag.ToString() == flag)
                                    {
                                        view.UpdataStatus(flag,updateTemp.sid, sensorAttr.state);
                                        view.UpdataStatus(flag,updateTemp, sensorAttr.state);
                                    }
                                }
@@ -703,14 +703,12 @@
        List<Function> sensorList = new List<Function>();
        string imagePath = "";
        string iconPath = "";
        string sensorSPK = "";
        Sensor sensorTemp = new Sensor();
        double assembleValues = 0.0;
        public SensorView(List<Function> showList, int index)//,,string spk,double value)
        {
            sensorList = showList;
            sensorSPK = showList[0].spk;
            foreach (var s in showList)
            {
                assembleValues += Convert.ToDouble(s.GetAttrState("value").Replace(",", "."));
@@ -721,7 +719,7 @@
            this.Width = Application.GetRealWidth(182);
            this.Height = Application.GetRealWidth(124);
            this.Y = Application.GetRealWidth(124 * (index / 2));
            this.Tag = sensorSPK;
            this.Tag = showList[0].spk;
            if (index % 2 != 0)
            {
@@ -729,7 +727,7 @@
            }
            switch (sensorSPK)
            switch (showList[0].spk)
            {
                case SPK.SensorCO2:
                    imagePath = "FunctionIcon/EnvirSensor/Co2Bg.png";
@@ -794,11 +792,11 @@
            this.AddChidren(btnInfoIcon);
            btnInfoIcon.MouseUpEventHandler = (sender, e) =>
            {
                LoadInfo(sensorSPK);
                LoadInfo(sensor);
            };
            var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues);
            var levelTextList = sensorTemp.GetLevelTextList(sensorSPK);
            var curLevel = sensorTemp.GetCurLevel(sensor);
            var levelTextList = sensorTemp.GetLevelTextList(sensor);
            btnLevel = new Button()
            {
                X = Application.GetRealWidth(25),
@@ -806,9 +804,9 @@
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(32),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1],
                TextColor = sensorTemp.GetLevelColorList(sensor)[curLevel - 1],
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = levelTextList[curLevel - 1],
                Text = levelTextList[curLevel - 1],
                Tag = "SensorLevel",
            };
            this.AddChidren(btnLevel);
@@ -853,10 +851,10 @@
        /// <summary>
        /// 加载传感器等级相关信息
        /// </summary>
        void LoadInfo(string sensorSPK)
        void LoadInfo(Function sensor)
        {
            var levelColorList = sensorTemp.GetLevelColorList(sensorSPK);
            var levelTextList = sensorTemp.GetLevelTextList(sensorSPK);
            var levelColorList = sensorTemp.GetLevelColorList(sensor);
            var levelTextList = sensorTemp.GetLevelTextList(sensor);
            Dialog dialog = new Dialog();
            FrameLayout dialogBodyView = new FrameLayout();
@@ -889,7 +887,7 @@
            };
            infoView.AddChidren(btnTitle);
            switch (sensorSPK)
            switch (sensor.spk)
            {
                case SPK.SensorPm25:
                    btnTitle.Text = "PM2.5(ug/m³)";
@@ -898,7 +896,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)";
@@ -973,7 +971,7 @@
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    IsBold = true,
                    Text = sensorTemp.GetIntervalValue(sensorSPK)[index]
                    Text = sensorTemp.GetIntervalValue(sensor)[index]
                });
                subInfoView.AddChidren(new Button()
@@ -984,7 +982,7 @@
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    IsBold = true,
                    TextID = levelTextList[index]
                    Text = levelTextList[index]
                });
                subInfoView.AddChidren(new Button()
@@ -1019,13 +1017,13 @@
        /// 更新状态
        /// </summary>
        /// <param name="updateTemp"></param>
        public void UpdataStatus(string spk ,string sid,string value)
        public void UpdataStatus(string spk ,Function function,string value)
        {
            try
            {
                if (spk == sensorSPK)
                if (spk == function.spk)
                {
                    var temp = sensorList.Find((obj) => obj.sid == sid);
                    var temp = sensorList.Find((obj) => obj.sid == function.sid);
                    if(temp!= null)
                    {
                        temp.SetAttrState("value", value);
@@ -1035,10 +1033,10 @@
                    btnSensorValues.Text = assembleValues.ToString();
                    var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues);
                    var curLevel = sensorTemp.GetCurLevel(function);
                    btnLevel.TextID = sensorTemp.GetLevelTextList(sensorSPK)[curLevel- 1];
                    btnLevel.TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1];
                    btnLevel.Text = sensorTemp.GetLevelTextList(temp)[curLevel- 1];
                    btnLevel.TextColor = sensorTemp.GetLevelColorList(function)[curLevel - 1];
                }
            }
            catch (Exception ex)