From c2348ebb81ca12b72eee6fbe9eee47925c1a5b07 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 06 九月 2023 12:02:54 +0800
Subject: [PATCH] Merge branch 'wxr-2.1' into wxr-2.0
---
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 163 +++++++++++++++++++++++++++++++++++++----------------
1 files changed, 113 insertions(+), 50 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index 6c33b71..e6f5b27 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)
{
@@ -388,6 +392,10 @@
imagePath = "FunctionIcon/EnvirSensor/HchoBg.png";
iconPath = "FunctionIcon/EnvirSensor/HchoIcon.png";
break;
+ case SPK.SensorLight:
+ imagePath = "FunctionIcon/EnvirSensor/IlluminationBg.png";
+ iconPath = "FunctionIcon/EnvirSensor/IlluminationIcon.png";
+ break;
}
sensorView.BackgroundImagePath = imagePath;
@@ -409,6 +417,10 @@
btnIcon.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
#region
var esp = new EnvironmentalSensorPage(sensor);
MainPage.BasePageView.AddChidren(esp);
@@ -428,6 +440,10 @@
sensorView.AddChidren(btnInfoIcon);
btnInfoIcon.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
LoadInfo(sensor);
};
@@ -438,15 +454,17 @@
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(32),
TextAlignment = TextAlignment.CenterLeft,
- 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) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
#region
var esp = new EnvironmentalSensorPage(sensor);
MainPage.BasePageView.AddChidren(esp);
@@ -472,6 +490,11 @@
sensorView.AddChidren(btnSensorValues);
btnSensorValues.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
+
#region
var esp = new EnvironmentalSensorPage(sensor);
MainPage.BasePageView.AddChidren(esp);
@@ -479,7 +502,18 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
#endregion
};
-
+ if (!IsSupportClick(sensor))
+ {
+ btnLevel.TextID = StringId.guangzhao;
+ btnLevel.TextColor = 0xFF1B2D4D;
+ btnSensorValues.Text = sensor.GetAttrState("illuminance");
+ }
+ else
+ {
+ btnLevel.TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1];
+ btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1];
+ btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value);
+ }
}
}
@@ -491,6 +525,7 @@
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);
@@ -510,7 +545,9 @@
{
levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
- foreach(var iii in levelTextList)
+ intervalList = sensorTemp.GetIntervalValue(sensor.spk);
+
+ foreach (var iii in levelTextList)
{
levelText.Add(Language.StringByID(iii));
}
@@ -550,7 +587,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)";
@@ -607,55 +644,65 @@
IsBold = true,
TextID = StringId.ColorValue,
});
- for (int index = 0; index < levelText.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,
- Text = levelText[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}");
+ }
@@ -788,8 +835,24 @@
}
-
-
+ /// <summary>
+ /// 鏄惁鏀寔浜嬩欢
+ /// </summary>
+ /// <param name="device"></param>
+ /// <returns></returns>
+ bool IsSupportClick(Function device)
+ {
+ if (device == null)
+ {
+ return false;
+ }
+ if (device.spk == SPK.SensorLight)
+ {
+ //鍏堣繃婊ゆ帀鍏夌収浼犳劅鍣�
+ return false;
+ }
+ return true;
+ }
#region event
--
Gitblit v1.8.0