From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 09:01:53 +0800
Subject: [PATCH] 更新
---
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index e10d48d..aeb5a12 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -274,7 +274,7 @@
int index = 0;
foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
- if(sensor.spk == SPK.SensorEnvironment)
+ if(SPK.EvironmentSensorList().Contains(sensor.spk))
{
foreach (var seTemp in sensor.attributes)
{
@@ -285,7 +285,9 @@
deviceId = sensor.deviceId,
roomIds = sensor.roomIds,
attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue }
- ,new FunctionAttributes { key = "spk"} }
+ , new FunctionAttributes {key = "spk",state = seTemp.key,curValue = seTemp.key }
+ //,new FunctionAttributes { key = "spk"}
+ }
};
switch (seTemp.key)
{
@@ -309,6 +311,8 @@
newTemp.spk = SPK.SensorTVOC;
newTemp.SetAttrState("spk", "tvoc");
break;
+ default:
+ continue;
}
if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
@@ -322,6 +326,8 @@
{
if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
{
+ var spkValue = sensor.attributes.Find((obj) => obj.key == "value") == null ? sensor.spk.Replace("sensor.", "").Replace(".", ""):"value";
+ sensor.attributes.Add(new FunctionAttributes { key = "spk", state = spkValue, curValue = spkValue });
LoadSensorDiv(sensor, index);
index++;
}
@@ -378,6 +384,10 @@
imagePath = "FunctionIcon/EnvirSensor/TempBg.png";
iconPath = "FunctionIcon/EnvirSensor/TempIcon.png";
break;
+ case SPK.SensorHcho:
+ imagePath = "FunctionIcon/EnvirSensor/HchoBg.png";
+ iconPath = "FunctionIcon/EnvirSensor/HchoIcon.png";
+ break;
}
sensorView.BackgroundImagePath = imagePath;
@@ -428,12 +438,13 @@
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(32),
TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.FirstLevelTitleColor,
+ 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) =>
{
#region
@@ -520,13 +531,16 @@
btnTitle.Text = Language.StringByID(StringId.Temp) + "(掳C)";
break;
case SPK.SensorTVOC:
- btnTitle.Text = "TVOC(PPM)";
+ btnTitle.Text = "TVOC(PPB)";
break;
case SPK.SensorCO2:
btnTitle.Text = "CO2(PPM)";
break;
case SPK.SensorHumidity:
btnTitle.Text = Language.StringByID(StringId.Humidity) + "(%)";
+ break;
+ case SPK.SensorHcho:
+ btnTitle.Text = Language.StringByID(StringId.Formaldehyde) +"(mg/m3)";
break;
}
@@ -762,7 +776,7 @@
{
if (bodyView != null)
{
- if (updateTemp.spk == SPK.SensorEnvironment)
+ if (SPK.EvironmentSensorList().Contains(updateTemp.spk ))
{
foreach (var seTemp in updateTemp.attributes)
{
@@ -790,6 +804,9 @@
case "tvoc":
newTemp.spk = SPK.SensorTVOC;
break;
+ case "hcho":
+ newTemp.spk = SPK.SensorHcho;
+ break;
}
if(!string.IsNullOrEmpty(newTemp.spk))
{
@@ -815,10 +832,36 @@
{
if (btn.Tag != null)
{
+ FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value);
+ if(attr == null)
+ {
+ switch(updateTemp.spk)
+ {
+ case SPK.SensorCO2:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2);
+ break;
+ case SPK.SensorTemperature:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature);
+ break;
+ case SPK.SensorTVOC:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Tvoc);
+ break;
+ case SPK.SensorPm25:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm25);
+ break;
+ case SPK.SensorHcho:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Hcho);
+ break;
+ case SPK.SensorHumidity:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
+ break;
+ }
+ }
+
var tag = btn.Tag.ToString();
if (tag == "SensorValues")
{
- (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
+ (btn as Button).Text = attr.state;// updateTemp.GetAttrState(FunctionAttributeKey.Value);
}
else if (tag == "SensorLevel")
{
--
Gitblit v1.8.0