From 264f86c363a6a019fac8eb138877fee9e4734e2d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 21 八月 2021 17:45:44 +0800
Subject: [PATCH] Merge branch 'WJC' into wxr7
---
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 192 +++++++++++++++++++++++++++++++++++------------
1 files changed, 142 insertions(+), 50 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index f48dad4..7801755 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -29,6 +29,8 @@
/// </summary>
FrameLayout sensorListView;
+ VerticalScrolViewLayout sensorListContentView;
+
/// <summary>
/// 澶╂皵鍚嶇О鏂囨湰
/// </summary>
@@ -153,7 +155,7 @@
TextColor = CSS_Color.TextualColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = "10掳C",
+ Text = $"{MainPage.cityInfo.highestTemperature}掳C",
};
topWeatherView.AddChidren(btnTempUpperLimitText);
@@ -176,7 +178,7 @@
TextColor = CSS_Color.TextualColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = "2掳C",
+ Text = $"{MainPage.cityInfo.lowestTemperature}掳C",
};
topWeatherView.AddChidren(btnTempLowerLimitText);
@@ -237,17 +239,18 @@
contentView.AddChidren(btnRoomClickRow);
#endregion
-
- sensorListView = new FrameLayout()
+ sensorListContentView = new VerticalScrolViewLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(50),
- Height = Application.GetRealHeight(456),
+ Height = Application.GetRealHeight(400),
Radius = (uint)Application.GetRealWidth(12),
BorderColor = 0x00000000,
BorderWidth = 0,
};
- contentView.AddChidren(sensorListView);
+ contentView.AddChidren(sensorListContentView);
+ sensorListView = new FrameLayout();
+ sensorListContentView.AddChidren(sensorListView);
LoadSenesorList();
@@ -271,22 +274,80 @@
int index = 0;
foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
- LoadSensorDiv(sensor, index);
- index++;
+ if(SPK.EvironmentSensorList().Contains(sensor.spk))
+ {
+ foreach (var seTemp in sensor.attributes)
+ {
+ var newTemp = new Function()
+ {
+ name = sensor.name,
+ sid = sensor.sid,
+ deviceId = sensor.deviceId,
+ roomIds = sensor.roomIds,
+ attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue }
+ ,new FunctionAttributes { key = "spk"} }
+ };
+ switch (seTemp.key)
+ {
+ case "co2":
+ newTemp.spk = SPK.SensorCO2;
+ newTemp.SetAttrState("spk", "co2");
+ break;
+ case "pm25":
+ newTemp.spk = SPK.SensorPm25;
+ newTemp.SetAttrState("spk", "pm25");
+ break;
+ case "humidity":
+ newTemp.spk = SPK.SensorHumidity;
+ newTemp.SetAttrState("spk", "humidity");
+ break;
+ case "temperature":
+ newTemp.spk = SPK.SensorTemperature;
+ newTemp.SetAttrState("spk", "temperature");
+ break;
+ case "tvoc":
+ newTemp.spk = SPK.SensorTVOC;
+ newTemp.SetAttrState("spk", "tvoc");
+ break;
+ default:
+ continue;
+ break;
+ }
+
+ if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
+ {
+ LoadSensorDiv(newTemp, index);
+ index++;
+ }
+ }
+ }
+ else
+ {
+ if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
+ {
+ LoadSensorDiv(sensor, index);
+ index++;
+ }
+ }
+
+ new System.Threading.Thread(() =>
+ {
+ Control.Ins.SendReadCommand(sensor);
+ })
+ { IsBackground = true }.Start();
}
+ sensorListView.Height = Application.GetRealWidth(124 * (index + 1) / 2);
}
/// <summary>
/// 鍔犺浇浼犳劅鍣ㄥ垪琛�
/// </summary>
- void LoadSensorDiv(Function sensor, int index)
+ void LoadSensorDiv(Function sensor,int index)
{
var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
-
- if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
{
- var sensorTag = sensor.sid;
+ var sensorTag = sensor.spk + sensor.sid + sensor.deviceId;
FrameLayout sensorView = new FrameLayout()
{
X = Application.GetRealWidth(7),
@@ -370,7 +431,7 @@
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(32),
TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.FirstLevelTitleColor,//levelColorList[sensorTemp.GetCurLevel(sensor) - 1],
+ TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.SubheadingFontSize,
TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
Tag = "SensorLevel",
@@ -410,18 +471,7 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
#endregion
};
- //btnLevel.MouseUpEventHandler = (sender, e) =>
- //{
- // LoadInfo(sensor);
- //};
-
-
- new System.Threading.Thread(() =>
- {
- Control.Ins.SendReadCommand(sensor);
- })
- { IsBackground = true }.Start();
}
}
@@ -711,46 +761,88 @@
{
Application.RunOnMainThread(() =>
{
- if (bodyView != null)
+ try
{
- for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
+ if (bodyView != null)
{
- var sensorTag = updateTemp.sid;
- var view = bodyView.sensorListView.GetChildren(i);
- if (view.GetType() == typeof(FrameLayout))
+ if (SPK.EvironmentSensorList().Contains(updateTemp.spk ))
{
- if (view.Tag.ToString() != sensorTag)
+ foreach (var seTemp in updateTemp.attributes)
{
- continue;
- }
- for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
- {
- var btn = (view as FrameLayout).GetChildren(j);
- if (btn.GetType() == typeof(Button))
+ var newTemp = new Function()
{
- if (btn.Tag != null)
+ name = updateTemp.name,
+ sid = updateTemp.sid,
+ deviceId = updateTemp.deviceId,
+ attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state ,curValue = seTemp.curValue} },
+ };
+ switch (seTemp.key)
+ {
+ case "co2":
+ newTemp.spk = SPK.SensorCO2;
+ break;
+ case "pm25":
+ newTemp.spk = SPK.SensorPm25;
+ break;
+ case "humidity":
+ newTemp.spk = SPK.SensorHumidity;
+ break;
+ case "temperature":
+ newTemp.spk = SPK.SensorTemperature;
+ break;
+ case "tvoc":
+ newTemp.spk = SPK.SensorTVOC;
+ break;
+ }
+ if(!string.IsNullOrEmpty(newTemp.spk))
+ {
+ LoadEvent_UpdataStatus(newTemp);
+ }
+ }
+ }
+
+ for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
+ {
+ var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId;
+ var view = bodyView.sensorListView.GetChildren(i);
+ if (view.GetType() == typeof(FrameLayout))
+ {
+ if (view.Tag.ToString() != sensorTag)
+ {
+ continue;
+ }
+ for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
+ {
+ var btn = (view as FrameLayout).GetChildren(j);
+ if (btn.GetType() == typeof(Button))
{
- var tag = btn.Tag.ToString();
- if (tag == "SensorValues")
+ if (btn.Tag != null)
{
- (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
- }
- else if (tag == "SensorLevel")
- {
- (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];
+ var tag = btn.Tag.ToString();
+ if (tag == "SensorValues")
+ {
+ (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
+ }
+ else if (tag == "SensorLevel")
+ {
+ (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];
+ }
}
}
- }
- else if (btn.GetType() == typeof(ArcSeekBar))
- {
- (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[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).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
+ (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
+ }
}
}
}
}
+ }catch(Exception ex )
+ {
+ MainPage.Log($"鏇存柊鐜浼犳劅鍣ㄧ晫闈㈠紓甯�:{ex.Message}");
}
});
}
--
Gitblit v1.8.0