From b562a582ac3a288193e6e4f57c5eff8a344305a4 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 27 九月 2024 13:52:17 +0800
Subject: [PATCH] Update AndroidManifest.xml
---
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 228 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 166 insertions(+), 62 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
index aeb5a12..07f386f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Reflection;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
@@ -91,7 +92,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
TextColor = CSS_Color.FirstLevelTitleColor,
- Text = MainPage.cityInfo.location,
+ Text = MainPage.cityInfo.city,
};
topWeatherView.AddChidren(btnLocationText);
@@ -243,7 +244,7 @@
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(50),
- Height = Application.GetRealHeight(400),
+ Height = Application.GetRealHeight(390),
Radius = (uint)Application.GetRealWidth(12),
BorderColor = 0x00000000,
BorderWidth = 0,
@@ -274,7 +275,8 @@
int index = 0;
foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
- if(SPK.EvironmentSensorList().Contains(sensor.spk))
+
+ if(SPK.EvironmentSensorList().Contains(sensor.spk) )
{
foreach (var seTemp in sensor.attributes)
{
@@ -347,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()
@@ -372,6 +374,10 @@
imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png";
iconPath = "FunctionIcon/EnvirSensor/Pm25Icon.png";
break;
+ case SPK.SensorPm10:
+ imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png";
+ iconPath = "FunctionIcon/EnvirSensor/Pm10Icon.png";
+ break;
case SPK.SensorTVOC:
imagePath = "FunctionIcon/EnvirSensor/TvocBg.png";
iconPath = "FunctionIcon/EnvirSensor/TvocIcon.png";
@@ -387,6 +393,10 @@
case SPK.SensorHcho:
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 +419,10 @@
btnIcon.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
#region
var esp = new EnvironmentalSensorPage(sensor);
MainPage.BasePageView.AddChidren(esp);
@@ -428,6 +442,10 @@
sensorView.AddChidren(btnInfoIcon);
btnInfoIcon.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
LoadInfo(sensor);
};
@@ -438,15 +456,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 +492,11 @@
sensorView.AddChidren(btnSensorValues);
btnSensorValues.MouseUpEventHandler = (sender, e) =>
{
+ if (!IsSupportClick(sensor))
+ {
+ return;
+ }
+
#region
var esp = new EnvironmentalSensorPage(sensor);
MainPage.BasePageView.AddChidren(esp);
@@ -479,7 +504,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.Text = levelTextList[sensorTemp.GetCurLevel(sensor) - 1];
+ btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor)[sensorTemp.GetCurLevel(sensor) - 1];
+ btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value);
+ }
}
}
@@ -488,8 +524,36 @@
/// </summary>
void LoadInfo(Function sensor)
{
- var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
- var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
+ List<uint> levelColorList = new List<uint>();
+ 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)
+ //{
+ // 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)
+ {
+ 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();
FrameLayout dialogBodyView = new FrameLayout();
@@ -525,13 +589,16 @@
switch (sensor.spk)
{
case SPK.SensorPm25:
- btnTitle.Text = "PM2.5(ug/m虏)";
+ btnTitle.Text = "PM2.5(ug/m鲁)";//虏
+ break;
+ case SPK.SensorPm10:
+ btnTitle.Text = "PM10(ug/m鲁)";//虏
break;
case SPK.SensorTemperature:
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)";
@@ -582,55 +649,65 @@
IsBold = true,
TextID = StringId.ColorValue,
});
- for (int index = 0; index < levelTextList.Count; index++)
+ try
{
- infoView.AddChidren(new Button()
+ for (int index = 0; index < levelTextList.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 = intervalList[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,
- TextID = levelTextList[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 = levelTextList[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}");
+ }
@@ -763,8 +840,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
@@ -815,6 +908,7 @@
}
}
+ Console.WriteLine(updateTemp.spk);
for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
{
var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId;
@@ -833,12 +927,15 @@
if (btn.Tag != null)
{
FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value);
- if(attr == null)
+ if (attr == null)
{
- switch(updateTemp.spk)
+ switch (updateTemp.spk)
{
case SPK.SensorCO2:
attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2);
+ break;
+ case SPK.SensorPm10:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm10);
break;
case SPK.SensorTemperature:
attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature);
@@ -855,6 +952,10 @@
case SPK.SensorHumidity:
attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity);
break;
+ case SPK.SensorLight:
+ attr = updateTemp.GetAttribute(FunctionAttributeKey.Illuminance);
+ break;
+
}
}
@@ -865,16 +966,19 @@
}
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];
+ if (updateTemp.spk != SPK.SensorLight)
+ {
+ (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);
}
}
}
--
Gitblit v1.8.0