From f339e5c8b04d1ab94f78e4e9343d5f67bb202589 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期三, 01 九月 2021 15:15:28 +0800 Subject: [PATCH] 更新 --- HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs | 2 HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 26 HDL-ON_Android/Assets/Language.ini | 10 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs | 2 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 10 HDL_ON/HDL_ON.projitems | 1 HDL_ON/Entity/Function/Sensor.cs | 76 +++ HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 1 HDL-ON_iOS/Info.plist | 4 HDL-ON_iOS/Resources/Language.ini | 10 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs | 5 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs | 1052 ++++++++++++++++++++++++++++++++++++++++++ HDL_ON/DAL/DriverLayer/Packet.cs | 12 .vs/HDL_APP_Project/xs/UserPrefs.xml | 17 HDL_ON/DAL/DriverLayer/Control.cs | 2 HDL_ON/UI/MainPage.cs | 2 HDL_ON/Entity/Function/Scene.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 4 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 86 +- HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs | 17 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 3 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs | 5 HDL_ON/Entity/FunctionList.cs | 2 HDL_ON/Entity/Function/Function.cs | 21 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 96 +- HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 4 28 files changed, 1,343 insertions(+), 135 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 5811ce9..4cd7f97 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,15 +1,15 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/MainPage.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs"> <Files> - <File FileName="HDL-ON_iOS/Info.plist" /> - <File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="55" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs" Line="367" Column="73" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs" Line="1046" Column="57" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL-ON_Android" expanded="True" selected="True" /> + <Node name="HDL-ON_Android" selected="True" /> </Node> </State> </Pad> @@ -27,14 +27,17 @@ <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="431" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="747" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="758" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferUserConfirmPage.cs" line="106" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="168" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" line="461" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="481" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="541" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="314" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="783" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="492" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="491" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" line="153" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="338" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2144" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index c27f087..5bbb86e 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -489,8 +489,8 @@ 501=Security alarm: {0} is triggered. 502=Clear the security alarm? 503=Exceeding standard -504=Secondary standard -505=Class I standard +504=Good +505=Excellent 506=Face input succeeded 507=Face input failed 508=Formaldehyde @@ -998,7 +998,7 @@ 7141=Exceeding 7142=Serious 7143=High -7144=excellence +7144=Excellence 7145=Security 7146=Add security 7147=Arm @@ -1605,8 +1605,8 @@ 501=瀹夐槻鎶ヨ锛歿0}琚Е鍙戙�� 502=鏄惁瑙i櫎瀹夐槻璀︽姤锛� 503=瓒呮爣 -504=浜岀骇 -505=涓�绾� +504=鑹ソ +505=浼樼 506=浜鸿劯褰曞叆鎴愬姛 507=浜鸿劯褰曞叆澶辫触 508=鐢查啗 diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index c6c4f33..17f3253 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202108301" android:versionName="1.2.202108301" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109012" android:versionName="1.2.202109012" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" /> <!-- 涔愭鍙瀵硅闇�瑕佺殑鏉冮檺 --> <!--<uses-permission android:name="android.permission.INTERNET" />--> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 8cc4834..2b3ea42 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -100,9 +100,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.2.202108301</string> + <string>1.2.202100911</string> <key>CFBundleVersion</key> - <string>1.2.08301</string> + <string>1.2.09011</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Use geographic location to provide services such as weather</string> <key>NSAppleMusicUsageDescription</key> diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index c27f087..5bbb86e 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -489,8 +489,8 @@ 501=Security alarm: {0} is triggered. 502=Clear the security alarm? 503=Exceeding standard -504=Secondary standard -505=Class I standard +504=Good +505=Excellent 506=Face input succeeded 507=Face input failed 508=Formaldehyde @@ -998,7 +998,7 @@ 7141=Exceeding 7142=Serious 7143=High -7144=excellence +7144=Excellence 7145=Security 7146=Add security 7147=Arm @@ -1605,8 +1605,8 @@ 501=瀹夐槻鎶ヨ锛歿0}琚Е鍙戙�� 502=鏄惁瑙i櫎瀹夐槻璀︽姤锛� 503=瓒呮爣 -504=浜岀骇 -505=涓�绾� +504=鑹ソ +505=浼樼 506=浜鸿劯褰曞叆鎴愬姛 507=浜鸿劯褰曞叆澶辫触 508=鐢查啗 diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 214efec..d493641 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1000,6 +1000,7 @@ HomePage.LoadEvent_RefreshEnvirIndoorHumi(); } EnvironmentalPage.LoadEvent_UpdataStatus(localFunction); + A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(localFunction); break; case SPK.SensorEnvironment: case SPK.SensorEnvironment2: @@ -1013,6 +1014,7 @@ HomePage.LoadEvent_RefreshEnvirIndoorHumi(); } EnvironmentalPage.LoadEvent_UpdataStatus(localFunction); + A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(localFunction); break; case SPK.ElectricSocket: SocketPage.UpdataState(localFunction); diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index 5994565..38e3df8 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -519,21 +519,27 @@ case SPK.SensorTemperature: byte[] tempBytes = new byte[] { receiveBytes[24], receiveBytes[25], receiveBytes[26], receiveBytes[27] }; sensor.SetAttrState(FunctionAttributeKey.Value,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); + sensor.SetAttrState(sensor.spk,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); break; case SPK.SensorHumidity: sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); + sensor.SetAttrState(sensor.spk, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); break; case SPK.SensorTVOC: sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); + sensor.SetAttrState(sensor.spk, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); break; case SPK.SensorPm25: sensor.SetAttrState(FunctionAttributeKey.Value,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); + sensor.SetAttrState(sensor.spk,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); break; case SPK.SensorCO2: sensor.SetAttrState(FunctionAttributeKey.Value, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); + sensor.SetAttrState(sensor.spk, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); break; } EnvironmentalPage.LoadEvent_UpdataStatus(sensor); + A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(sensor); } } } @@ -571,13 +577,16 @@ { case 1: sensor.SetAttrState(FunctionAttributeKey.Value,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); + sensor.SetAttrState(sensor.spk,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); break; case 2: sensor.SetAttrState(FunctionAttributeKey.Value,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); + sensor.SetAttrState(sensor.spk,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); break; case 3: byte[] tempBytes = new byte[] { receiveBytes[5], receiveBytes[6], receiveBytes[7], receiveBytes[8] }; sensor.SetAttrState(FunctionAttributeKey.Value,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); + sensor.SetAttrState(sensor.spk,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); break; } switch (receiveBytes[4]) @@ -587,9 +596,12 @@ { var value = Convert.ToInt32(sensor.GetAttrState(FunctionAttributeKey.Value)); sensor.SetAttrState(FunctionAttributeKey.Value, (value /= 100000).ToString()); + sensor.SetAttrState(sensor.spk, (value /= 100000).ToString()); } break; } + + A_EnvironmentalDataCenter.LoadEvent_UpdataStatus(sensor); EnvironmentalPage.LoadEvent_UpdataStatus(sensor); } } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 1d2e85d..143cc90 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1280,6 +1280,24 @@ public const string SensorHcho = "sensor.hcho"; /// <summary> + /// 鐜浼犳劅鍣ㄨ澶噑pk鍒楄〃 + /// </summary> + /// <returns></returns> + public static List<string> EnvironDeviceSpkList() + { + var spkList = new List<string>(); + spkList.Add(SensorTemperature); + spkList.Add(SensorPm25); + spkList.Add(SensorCO2); + spkList.Add(SensorTVOC); + spkList.Add(SensorHumidity); + spkList.Add(SensorEnvironment); + spkList.Add(SensorEnvironment2); + spkList.Add(SensorEnvironment3); + spkList.Add(SensorHcho); + return spkList; + } + /// <summary> /// 鐜浼犳劅鍣╯pk鍒楄〃 /// </summary> /// <returns></returns> @@ -1291,9 +1309,6 @@ spkList.Add(SensorCO2); spkList.Add(SensorTVOC); spkList.Add(SensorHumidity); - spkList.Add(SensorEnvironment); - spkList.Add(SensorEnvironment2); - spkList.Add(SensorEnvironment3); spkList.Add(SensorHcho); return spkList; } diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index fa6176f..b9d9039 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -593,6 +593,10 @@ case FunctionAttributeKey.RoomTemp: case FunctionAttributeKey.Brightness: case FunctionAttributeKey.Percent: + int outT = 0; + int.TryParse(catchString,out outT); + if (outT < 0) + catchString = "0"; if (catchString == "") { catchString = "0"; diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs index 341392a..a51a61c 100644 --- a/HDL_ON/Entity/Function/Sensor.cs +++ b/HDL_ON/Entity/Function/Sensor.cs @@ -285,5 +285,81 @@ } return level; } + + + /// <summary> + /// 褰撳墠绛夌骇 + /// </summary> + public int GetCurLevel(string spk,double values) + { + int level = 1; + switch (spk) + { + case SPK.SensorPm25: + if (values < 35) + level = 1; + else if (values < 75) + level = 2; + else if (values < 115) + level = 3; + else if (values > 115) + level = 4; + break; + case SPK.SensorCO2: + if (values < 1000) + level = 1; + else if (values < 2000) + level = 2; + else if (values < 5000) + level = 3; + else if (values >= 5000) + level = 4; + break; + case SPK.SensorTemperature: + if (values < 18) + level = 1; + else if (values < 20) + level = 2; + else if (values < 25) + level = 3; + else if (values < 27) + level = 4; + else if (values < 30) + level = 5; + else if (values < 33) + level = 6; + else if (values > 33) + level = 7; + break; + case SPK.SensorTVOC: + if (values < 600) + level = 1; + else if (values < 2000) + level = 2; + else if (values < 5000) + level = 3; + else if (values >= 5000) + level = 4; + break; + case SPK.SensorHumidity: + if (values > 70) + level = 1; + else if (values > 40) + level = 2; + else if (values < 40) + level = 3; + break; + case SPK.SensorHcho: + if (values <= 0.08) + level = 1; + else if (values <= 0.1) + level = 2; + else + level = 3; + break; + } + return level; + } + } } diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index d95e1ba..2419c00 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -128,7 +128,7 @@ /// </summary> public List<Function> GetEnvirSensorsList() { - var spkList = SPK.EnvironSpkList(); + var spkList = SPK.EnvironDeviceSpkList(); return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } /// <summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 016c4aa..ded84f8 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -484,6 +484,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\FaceManagement\CustomerObj.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Security.cs" /> <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index eea6c81..eae7a37 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -25,7 +25,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.2.0830"; + public static string VersionString = "1.2.0901"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index d48c498..81aecbf 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -392,6 +392,14 @@ if (temp.status == "enable") { btnSecurityStatus.IsSelected = true; + if (temp.alarm) + { + btnSecurityStatus.SelectedImagePath = "Collection/DefenseAlarmIcon.png"; + } + else + { + btnSecurityStatus.SelectedImagePath = "Collection/DefenseStatusIcon.png"; + } break; } } @@ -539,15 +547,15 @@ #if DEBUG - //FunctionList.List.Functions.Add(new Function() - //{ - // spk = SPK.AirSwitch, - // name = "鏅鸿兘绌哄紑", - // attributes = new List<FunctionAttributes>() - // { - // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, - // }, - //}); + FunctionList.List.Functions.Add(new Function() + { + spk = SPK.AirSwitch, + name = "鏅鸿兘绌哄紑", + attributes = new List<FunctionAttributes>() + { + new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, + }, + }); //FunctionList.List.Functions.Add(new Function() //{ diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index 4922410..013396b 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -38,6 +38,7 @@ { lock (FunctionList.List.securities) { + bodyView.btnSecurityStatus.IsSelected = false; foreach (var temp in FunctionList.List.securities) { if (temp.status == "enable") diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 97b26bb..2653cb9 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -973,7 +973,8 @@ btnName.TextID = StringId.EnvironmentalData; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { - var skipView = new EnvironmentalPage();// EnvironmentalSciencePage(); + //var skipView = new EnvironmentalPage();// EnvironmentalSciencePage(); + var skipView = new A_EnvironmentalDataCenter();// EnvironmentalSciencePage(); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs index a6dc46d..4a53bf1 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs @@ -364,7 +364,7 @@ { ///hcho LogicView.FunTypeView hchoView = new LogicView.FunTypeView(); - hchoView.btnText.TextID = StringId.tvoc; + hchoView.btnText.TextID = StringId.Formaldehyde; fLayout.AddChidren(hchoView.FLayoutView()); ///hcho鐐瑰嚮浜嬩欢 hchoView.btnClick.MouseUpEventHandler += (sender, e) => diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs index edb2001..d765641 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -1019,7 +1019,7 @@ text = Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)"; } break; - case "(0.09,0.1]": + case "(0.08,0.1]": { text = Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)"; } @@ -1112,7 +1112,7 @@ } else if (text == Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)") { - value = "(0.09,0.1]"; + value = "(0.08,0.1]"; } else if (text == Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)") { diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index 91a1d58..b5ec1d8 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -225,7 +225,7 @@ sceneFunctionView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(53), - Height = Application.GetRealHeight(667 - 64 - 49 - 52 + 30), + Height = Application.GetRealHeight(667 - 64 - 49 - 52 + 0), }; scenePageView.AddChidren(sceneFunctionView); LoadSceneFunctionControlZone(null); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 93b3af5..9c69d90 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -279,6 +279,10 @@ } else if (sceneStatus.key == FunctionAttributeKey.Brightness || sceneStatus.key == FunctionAttributeKey.Percent) { + int outT = 0; + int.TryParse(sceneStatus.value, out outT); + if (outT < 0) + sceneStatus.value = "0"; btnBrightnessText = btnFunctionText; } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 8ad95c4..411dc74 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -138,10 +138,10 @@ /// 鑾峰彇鏀寔灏忓尯鍩� /// </summary> VerticalScrolViewLayout supportView; - /// <summary> - /// 鑾峰彇鏀寔鏂囨湰 - /// </summary> - Button btnSupportText; + ///// <summary> + ///// 鑾峰彇鏀寔鏂囨湰 + ///// </summary> + //Button btnSupportText; /// <summary> /// 鍏充簬On鏂囨湰 @@ -795,7 +795,7 @@ if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) { //supportView 鍔犻珮 鏄剧ず3琛� 3*44 - supportView.Height = Application.GetRealWidth(3*44); + supportView.Height = Application.GetRealWidth(2*44); FrameLayout smartSpeakerView = new FrameLayout() { @@ -850,53 +850,53 @@ #endregion #region 鑾峰彇鏀寔 - FrameLayout supView = new FrameLayout() - { - Height = Application.GetRealWidth(44), - }; - supportView.AddChidren(supView); + //FrameLayout supView = new FrameLayout() + //{ + // Height = Application.GetRealWidth(44), + //}; + //supportView.AddChidren(supView); - Button btnSupportIcon = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(10), - Width = Application.GetMinRealAverage(24), - Height = Application.GetMinRealAverage(24), - UnSelectedImagePath = "PersonalCenter/SupportIcon.png", - }; - supView.AddChidren(btnSupportIcon); + //Button btnSupportIcon = new Button() + //{ + // X = Application.GetRealWidth(12), + // Y = Application.GetRealWidth(10), + // Width = Application.GetMinRealAverage(24), + // Height = Application.GetMinRealAverage(24), + // UnSelectedImagePath = "PersonalCenter/SupportIcon.png", + //}; + //supView.AddChidren(btnSupportIcon); - btnSupportText = new Button() - { - X = Application.GetRealWidth(48), - Width = Application.GetRealWidth(270), - Height = Application.GetRealWidth(44), - TextID = StringId.GetSupport, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.CenterLeft, - TextSize = CSS_FontSize.TextFontSize - }; - supView.AddChidren(btnSupportText); + //btnSupportText = new Button() + //{ + // X = Application.GetRealWidth(48), + // Width = Application.GetRealWidth(270), + // Height = Application.GetRealWidth(44), + // TextID = StringId.GetSupport, + // TextColor = CSS_Color.FirstLevelTitleColor, + // TextAlignment = TextAlignment.CenterLeft, + // TextSize = CSS_FontSize.TextFontSize + //}; + //supView.AddChidren(btnSupportText); - Button btnSupportRight = new Button() - { - X = Application.GetRealWidth(315), - Y = Application.GetRealWidth(14), - Width = Application.GetMinRealAverage(16), - Height = Application.GetMinRealAverage(16), - UnSelectedImagePath = "Public/Right.png", - }; - supView.AddChidren(btnSupportRight); + //Button btnSupportRight = new Button() + //{ + // X = Application.GetRealWidth(315), + // Y = Application.GetRealWidth(14), + // Width = Application.GetMinRealAverage(16), + // Height = Application.GetMinRealAverage(16), + // UnSelectedImagePath = "Public/Right.png", + //}; + //supView.AddChidren(btnSupportRight); - var btnSupportViewLine = new Button() - { - X = Application.GetRealWidth(48), - Y = Application.GetRealWidth(43), - Height = Application.GetRealHeight(1), - Width = Application.GetRealWidth(279), - BackgroundColor = CSS_Color.DividingLineColor - }; - supView.AddChidren(btnSupportViewLine); + //var btnSupportViewLine = new Button() + //{ + // X = Application.GetRealWidth(48), + // Y = Application.GetRealWidth(43), + // Height = Application.GetRealHeight(1), + // Width = Application.GetRealWidth(279), + // BackgroundColor = CSS_Color.DividingLineColor + //}; + //supView.AddChidren(btnSupportViewLine); #endregion #region 鍏充簬ON+ diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 8bd3b10..15277a4 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -33,41 +33,11 @@ } /// <summary> - /// 瀹夐槻閮ㄥ垎浜嬩欢 + /// 鏇存柊瀹夐槻鎺т欢鐘舵�� /// </summary> - void LoadEvent_SecurityEvent() + void LoadEvent_UpdataSenurityStatus() { - if (btnResidenceArmIcon != null) - { - btnResidenceArmIcon.IsSelected = false; - lock (FunctionList.List.securities) - { - foreach (var temp in FunctionList.List.securities) - { - if (temp.status == "enable") - { - if (temp.alarm) - { - btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceInAlarmIcon.png"; - } - else - { - btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png"; - } - btnResidenceArmIcon.IsSelected = true; - break; - } - } - } - btnResidenceArmIcon.MouseUpEventHandler = (sender, e) => - { - var page = new ArmCenterPage(); - MainPage.BasePageView.AddChidren(page); - page.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - } - if (btnResidenceArmText != null) + lock (FunctionList.List.securities) { btnResidenceArmText.TextID = StringId.Undefense; foreach (var temp in FunctionList.List.securities) @@ -75,16 +45,48 @@ if (temp.status == "enable") { btnResidenceArmText.TextID = StringId.Defense; + if (temp.alarm) + { + btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceInAlarmIcon.png"; + } + else + { + btnResidenceArmIcon.SelectedImagePath = "PersonalCenter/ResidenceDefenseIcon.png"; + } + btnResidenceArmIcon.IsSelected = true; break; } } - btnResidenceArmText.MouseUpEventHandler = (sender, e) => + } + } + + + /// <summary> + /// 瀹夐槻閮ㄥ垎浜嬩欢 + /// </summary> + void LoadEvent_SecurityEvent() + { + if (btnResidenceArmIcon != null&& btnResidenceArmText != null) + { + Action action = () =>{ + Application.RunOnMainThread(() => + { + LoadEvent_UpdataSenurityStatus(); + }); + }; + + + btnResidenceArmIcon.IsSelected = false; + LoadEvent_UpdataSenurityStatus(); + EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - var page = new ArmCenterPage(); + var page = new ArmCenterPage(action); MainPage.BasePageView.AddChidren(page); page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; + btnResidenceArmIcon.MouseUpEventHandler = eventHandler; + btnResidenceArmText.MouseUpEventHandler = eventHandler; } } @@ -357,13 +359,13 @@ /// </summary> void LoadEvent_SkipGetSupportPage() { - btnSupportText.MouseUpEventHandler = (sender, e) => - { - var getsupportPage = new FAQHelpPage(); - MainPage.BasePageView.AddChidren(getsupportPage); - getsupportPage.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; + //btnSupportText.MouseUpEventHandler = (sender, e) => + //{ + // var getsupportPage = new FAQHelpPage(); + // MainPage.BasePageView.AddChidren(getsupportPage); + // getsupportPage.LoadPage(); + // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + //}; } /// <summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs index 1a7fb2e..51d665c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshRelayControlPage.cs @@ -66,7 +66,10 @@ fanSpeedList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value; btnFan.MouseUpEventHandler += (sender, e) => { - ShowFanSelectView(); + if (btnSwitch.IsSelected) + { + ShowFanSelectView(); + } }; //椋庨�熸枃鏈� this.btnFanView = new NormalViewControl(this.FrameWhiteCentet1.Width / 3, Application.GetRealHeight(18), false); diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs index c56f5c7..03fb2c6 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -45,6 +45,14 @@ /// </summary> List<ArmDiyView> armDiyViewList = new List<ArmDiyView>(); + + Action refreshAction = null; + + public ArmCenterPage(Action action) + { + refreshAction = action; + bodyView = this; + } public ArmCenterPage() { bodyView = this; @@ -437,6 +445,8 @@ { if (bodyView != null) { + bodyView.refreshAction?.Invoke(); + //甯冮槻 if (updataTemp.status == "enable") { diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs index d693db6..8137029 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs @@ -148,7 +148,7 @@ }; controlView.AddChidren(btnSwitch); - new TopViewDiv(bodyView, Language.StringByID(StringId.Electric)).LoadTopView_FunctionTop(function, actionRefresh,false); + new TopViewDiv(bodyView, Language.StringByID(StringId.Electric)).LoadTopView_FunctionTop(function, actionRefresh); new System.Threading.Thread(() => { DriverLayer.Control.Ins.SendReadCommand(function); diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs new file mode 100644 index 0000000..967b540 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/A_EnvironmentalDataCenter.cs @@ -0,0 +1,1052 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DriverLayer; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + public class A_EnvironmentalDataCenter : FrameLayout + { + + #region 鎺т欢闆嗗悎 + static A_EnvironmentalDataCenter bodyView; + /// <summary> + /// 妤煎眰鏄剧ず + /// </summary> + Button btnRoom; + /// <summary> + /// 鎴块棿閫夋嫨涓嬫媺鍥炬爣 + /// </summary> + Button btnFoorDownIcon; + /// <summary> + /// 鎴块棿閫夋嫨瑙﹀彂鍖哄煙 + /// </summary> + Button btnRoomClickRow; + /// <summary> + /// 浼犳劅鍣ㄥ垪琛ㄥ尯鍩� + /// </summary> + FrameLayout sensorListView; + + VerticalScrolViewLayout sensorListContentView; + + /// <summary> + /// 澶╂皵鍚嶇О鏂囨湰 + /// </summary> + Button btnWatherText; + /// <summary> + /// 婀垮害鏁版嵁鏂囨湰 + /// </summary> + Button btnHumidityText; + /// <summary> + /// pm25鏁版嵁鏂囨湰 + /// </summary> + Button btnPm25Values; + /// <summary> + /// 椋庨�熸暟鎹枃鏈� + /// </summary> + Button btnFanSpeedValues; + + + + List<SensorView> sensorViewList = new List<SensorView>(); + #endregion + #region 鍖哄煙鍙橀噺 + Room room; + + Sensor sensorTemp = new Sensor(); + /// <summary> + /// 浼犳劅鍣ㄥ垎绫诲垪琛� + /// </summary> + Dictionary<string, List<Function>> sensorList = new Dictionary<string, List<Function>>(); + #endregion + + + public A_EnvironmentalDataCenter() + { + bodyView = this; + } + + /// <summary> + /// 鍔犺浇鐣岄潰 + /// </summary> + /// <param name="btnCollectionIcon">鏀惰棌鎸夐挳</param> + /// <param name="btnFunctionName">鍔熻兘鍚嶇О淇℃伅鎸夐挳</param> + /// <param name="btnFromFloor">鍔熻兘妤煎眰淇℃伅鎸夐挳</param> + public void LoadPage() + { + bodyView.BackgroundColor = CSS_Color.BackgroundColor; + + #region 椤堕儴澶╂皵閮ㄥ垎 + var topWeatherView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(73), + Width = Application.GetRealWidth(361), + Height = Application.GetRealWidth(166), + BackgroundImagePath = "FunctionIcon/EnvirSensor/0.png", + }; + bodyView.AddChidren(topWeatherView); + LoadEvent_ChangeWeatherIcon(topWeatherView); + + var btnLocationText = new Button() + { + X = Application.GetRealWidth(27), + Width = Application.GetRealWidth(74), + Height = Application.GetRealWidth(44), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = MainPage.cityInfo.location, + }; + topWeatherView.AddChidren(btnLocationText); + + + var btnTemp = new Button() + { + X = Application.GetRealWidth(21), + Y = Application.GetRealWidth(53), + Width = Application.GetRealWidth(78), + Height = Application.GetRealWidth(68), + TextSize = 60, + IsBold = true, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = MainPage.cityInfo.temperature, + }; + topWeatherView.AddChidren(btnTemp); + + var btnTempUint = new Button() + { + X = Application.GetRealWidth(109), + Y = Application.GetRealWidth(60), + Width = Application.GetRealWidth(20), + Height = Application.GetRealWidth(20), + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextColor = CSS_Color.TextualColor, + Text = "掳C", + }; + topWeatherView.AddChidren(btnTempUint); + + + btnWatherText = new Button() + { + X = Application.GetRealWidth(109), + Y = Application.GetRealWidth(82), + Width = Application.GetRealWidth(200), + Height = Application.GetRealWidth(20), + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = MainPage.cityInfo.weather + }; + topWeatherView.AddChidren(btnWatherText); + + var btnTempUpperLimit = new Button() + { + X = Application.GetRealWidth(107), + Y = Application.GetRealWidth(101), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "FunctionIcon/EnvirSensor/UpperLimit.png", + }; + topWeatherView.AddChidren(btnTempUpperLimit); + + var btnTempUpperLimitText = new Button() + { + X = btnTempUpperLimit.Right, + Y = Application.GetRealWidth(101), + Width = Application.GetRealWidth(42), + Height = Application.GetRealWidth(20), + TextColor = CSS_Color.TextualColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = $"{MainPage.cityInfo.highestTemperature}掳C", + }; + topWeatherView.AddChidren(btnTempUpperLimitText); + + var btnTempLowerLimit = new Button() + { + X = Application.GetRealWidth(156), + Y = Application.GetRealWidth(101), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "FunctionIcon/EnvirSensor/LowerLimit.png", + }; + topWeatherView.AddChidren(btnTempLowerLimit); + + var btnTempLowerLimitText = new Button() + { + X = btnTempLowerLimit.Right, + Y = Application.GetRealWidth(101), + Width = Application.GetRealWidth(42), + Height = Application.GetRealWidth(20), + TextColor = CSS_Color.TextualColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = $"{MainPage.cityInfo.lowestTemperature}掳C", + }; + topWeatherView.AddChidren(btnTempLowerLimitText); + + + var btnValue = new Button() + { + X = Application.GetRealWidth(27), + Y = Application.GetRealWidth(119), + Width = Application.GetRealWidth(300), + Height = Application.GetRealWidth(34), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, + TextColor = CSS_Color.TextualColor, + }; + topWeatherView.AddChidren(btnValue); + var valueText = Language.StringByID(StringId.EnvirSensorValueTip); + btnValue.Text = valueText.Replace("{0}", $"{MainPage.cityInfo.humidity}").Replace("{1}", $"{MainPage.cityInfo.pm25}").Replace("{2}", $"{MainPage.cityInfo.windLevel}"); + #endregion + + #region contentView + FrameLayout contentView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealWidth(239), + Height = Application.GetRealHeight(450), + }; + bodyView.AddChidren(contentView); + + #region 鎴块棿椤堕儴鍒囨崲鏄剧ず鍖哄煙 + room = new Room() { roomName = Language.StringByID(StringId.All) }; + btnFoorDownIcon = new Button() + { + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(18), + UnSelectedImagePath = "Public/DownIcon.png", + }; + contentView.AddChidren(btnFoorDownIcon); + + btnRoom = new Button() + { + X = btnFoorDownIcon.Right, + Y = Application.GetRealHeight(18), + Width = Application.GetRealWidth(200), + Height = Application.GetMinRealAverage(16), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = room.roomName, + }; + contentView.AddChidren(btnRoom); + + btnRoomClickRow = new Button() + { + Height = Application.GetRealHeight(40), + }; + contentView.AddChidren(btnRoomClickRow); + + #endregion + sensorListContentView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(50), + Height = Application.GetRealHeight(400), + Radius = (uint)Application.GetRealWidth(12), + BorderColor = 0x00000000, + BorderWidth = 0, + }; + contentView.AddChidren(sensorListContentView); + sensorListView = new FrameLayout(); + sensorListContentView.AddChidren(sensorListView); + + LoadSenesorList(); + + + + #endregion + + //LoadEventList(); + LoadDialog_ChangeRoom(); + + new TopViewDiv(bodyView, Language.StringByID(StringId.EnvironmentalScience)).LoadTopView(); + + } + + /// <summary> + /// 鍔犺浇浼犳劅鍣ㄥ垪琛� + /// </summary> + void LoadSenesorList() + { + sensorListView.RemoveAll(); + sensorViewList.Clear(); + + sensorList = new Dictionary<string, List<Function>>(); + int index = 0; + foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) + { + foreach (var sensorAttr in sensor.attributes) + { + if (SPK.EnvironSpkList().Contains(sensorAttr.key) || sensorAttr.key == "value") + { + var flag = sensorAttr.key; + if (flag == "value") + { + flag = sensor.spk.Replace("sensor.", ""); + } + var newTemp = new Function() + { + name = sensor.name, + sid = sensor.sid, + deviceId = sensor.deviceId, + roomIds = sensor.roomIds, + spk = "sensor."+ flag, + attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = sensorAttr.state, curValue = sensorAttr.curValue } + , new FunctionAttributes {key = "spk",state = sensorAttr.key,curValue = sensorAttr.key } } + }; + //鍒嗙被鍔犲叆闆嗗悎 + if (sensorList.ContainsKey(flag)) + { + sensorList[flag].Add(newTemp); + } + else + { + sensorList.Add(flag, new List<Function>() { newTemp }); + } + } + } + + new System.Threading.Thread(() => + { + Control.Ins.SendReadCommand(sensor); + }) + { IsBackground = true }.Start(); + } + + + foreach(var sensorAssemble in sensorList) + { + var showList = sensorAssemble.Value; + if(room.roomId != "") + { + showList = sensorAssemble.Value.FindAll((obj) => obj.roomIds.Contains(room.roomId)); + } + if (showList != null && showList.Count > 0) + { + var sensorView = new SensorView(showList,index); + sensorListView.AddChidren(sensorView); + sensorViewList.Add(sensorView); + sensorView.LoadView(); + + index++; + } + } + sensorListView.Height = Application.GetRealWidth(124 * (index + 1) / 2); + } + + + /// <summary> + /// 鎴块棿鍒楄〃鐐瑰嚮浜嬩欢 + /// </summary> + void LoadDialog_ChangeRoom() + { + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + var dialog = new Dialog(); + var dialogBody = new FrameLayout(); + dialog.AddChidren(dialogBody); + dialogBody.MouseUpEventHandler += (sender1, e1) => + { + dialog.Close(); + }; + + var dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(266), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(110), + BackgroundImagePath = "PersonalCenter/HomeList1bg.png", + }; + dialogBody.AddChidren(dispalyView); + + var contentView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(45 * 2), + ScrollEnabled = false + }; + dispalyView.AddChidren(contentView); + + if (SpatialInfo.CurrentSpatial.RoomList.Count < 2) + { + } + else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(266), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(155), + BackgroundImagePath = "PersonalCenter/HomeList2bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 3); + dispalyView.AddChidren(contentView); + } + else if (SpatialInfo.CurrentSpatial.RoomList.Count < 4) + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(266), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(200), + BackgroundImagePath = "PersonalCenter/HomeList3bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 4); + dispalyView.AddChidren(contentView); + } + else + { + dispalyView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(266), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(245), + BackgroundImagePath = "PersonalCenter/HomeList4bg.png", + }; + dialogBody.AddChidren(dispalyView); + + contentView.Height = Application.GetRealHeight(45 * 5); + contentView.ScrollEnabled = true; + dispalyView.AddChidren(contentView); + } + + + var showListRoom = new List<Room>(); + showListRoom.Add(new Room() { roomName = Language.StringByID(StringId.All) }); + showListRoom.AddRange(SpatialInfo.CurrentSpatial.RoomList); + + foreach (var roomTemp in showListRoom) + { + string roomName = roomTemp.roomName; + var btnRoomName = new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + Text = roomName, + TextSize = CSS_FontSize.SubheadingFontSize, + IsSelected = btnRoom.Text == roomName, + IsMoreLines = true, + Tag = roomName + }; + contentView.AddChidren(btnRoomName); + + btnRoomName.MouseUpEventHandler += (senderH, en) => + { + dialog.Close(); + btnRoom.Text = roomName; + room = roomTemp; + LoadSenesorList(); + }; + } + + dialog.Show(); + }; + + btnRoomClickRow.MouseUpEventHandler = eventHandler; + //btnFoorDownIcon.MouseUpEventHandler = eventHandler; + } + + + + + + #region event + + public static void LoadEvent_UpdataStatus(Function updateTemp) + { + Application.RunOnMainThread(() => + { + try + { + if (bodyView != null) + { + foreach (var sensorAttr in updateTemp.attributes) + { + if (SPK.EnvironSpkList().Contains(sensorAttr.key) || sensorAttr.key == "value") + { + var flag = sensorAttr.key; + if (flag == "value") + { + flag = updateTemp.spk.Replace("sensor.", ""); + } + + foreach (var view in bodyView.sensorViewList) + { + if (view.Tag.ToString() == flag) + { + view.UpdataStatus(flag,updateTemp.sid, sensorAttr.state); + } + } + + } + } + + } + } + catch (Exception ex) + { + MainPage.Log($"鏇存柊鐜浼犳劅鍣ㄧ晫闈㈠紓甯�:{ex.Message}"); + } + }); + } + + void LoadEvent_ChangeWeatherIcon(FrameLayout view) + { + + switch (MainPage.cityInfo.weather) + { + case "鏅�": + case "Sunny": + case "鏅村ぉ": + case "澶╂櫞": + case "Clear": + case "澶ч儴鏅存湕": + case "Mostly Sunny": + case "鏅存檪澶氶洸": + case "闄藉厜鍏呮矝": + case "Mostly Clear": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/0.png"; + break; + case "澶氫簯": + case "Cloudy": + case "澶氶洸": + case "灏戜簯": + case "Partly Cloudy": + case "灏戦洸": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/1.png"; + break; + case "闃�": + case "Overcast": + case "闄板ぉ": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/2.png"; + break; + case "闃甸洦": + case "Showers": + case "闄i洦": + case "椹熼洦": + case "灞�閮ㄩ樀闆�": + case "Scattered Showers": + case "灞�鍦伴櫍闆�": + case "灞�閮ㄥ湴鍗�鎬ч闆�": + case "灏忛樀闆�": + case "Light Showers": + case "灏忛櫍闆�": + case "闆舵暎椹熼洦": + case "寮洪樀闆�": + case "Heavy Showers": + case "寮烽櫍闆�": + case "闁撲腑鏈夐闆�": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png"; + break; + case "闃甸洩": + case "Snow Showers": + case "闄i洩": + case "椹熼洩": + case "灏忛樀闆�": + case "Light Snow Showers": + case "灏忛櫍闆�": + case "闆舵暎椹熼洩": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png"; + break; + case "闆�": + case "Fog": + case "闇�": + case "钖勯湩": + case "鍐婚浘": + case "Freezing Fog": + case "鍑嶉湩": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/18.png"; + break; + case "娌欏皹鏆�": + case "Sandstorm": + case "娌欏〉鏆�": + case "寮烘矙灏樻毚": + case "Heavy Sandstorm": + case "寮锋矙濉垫毚": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/20.png"; + break; + case "娴皹": + case "Dust": + case "娴〉": + case "灏樺嵎椋�": + case "Dust Storm": + case "濉垫嵅棰�": + case "鎵矙": + case "Sand": + case "鎻氭矙": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/29.png"; + break; + case "闇�": + case "Haze": + case "鐓欓湠": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/45.png"; + break; + case "闆烽樀闆�": + case "Thundershower": + case "闆烽櫍闆�": + case "闆烽洦": + case "闆风數": + case "Lightning": + case "闆烽浕": + case "闆锋毚": + case "Thunderstorm": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/4.png"; + break; + case "闆烽樀闆ㄤ即鏈夊啺闆�": + case "Thundershower with Hail": + case "闆烽櫍闆ㄤ即鏈夊啺闆�": + case "闆烽洦浼存湁鍐伴浌": + case "鍐伴浌": + case "Hail": + case "鍐伴拡": + case "Needle Ice": + case "鍐伴嚌": + case "鍐扮矑": + case "Icy": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/5.png"; + break; + case "闆ㄥす闆�": + case "Sleet": + case "闆ㄥぞ闆�": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/6.png"; + break; + case "灏忛洦": + case "Light Rain": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png"; + break; + case "涓洦": + case "Rain": + case "灏忓埌涓洦": + case "闆�": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png"; + break; + case "澶ч洦": + case "Heavy Rain": + case "涓埌澶ч洦": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png"; + break; + case "鏆撮洦": + case "Rainstorm": + case "璞洦": + case "澶ф毚闆�": + case "Heavy Rainstorm": + case "澶ц豹闆�": + case "鐗瑰ぇ鏆撮洦": + case "Extreme Rainstorm": + case "瓒呭ぇ璞洦": + case "澶у埌鏆撮洦": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png"; + break; + case "灏忛洩": + case "Light Snow": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png"; + break; + case "闆�": + case "涓洩": + case "灏忓埌涓洩": + case "Snow": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png"; + break; + case "澶ч洩": + case "Heavy Snow": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png"; + break; + case "鏆撮洩": + case "Blizzard": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png"; + break; + case "鍐婚洦": + case "Freezing Rain": + case "鍑嶉洦": + view.BackgroundImagePath = "FunctionIcon/EnvirSensor/6.png"; + break; + } + } + + #endregion + } + + + + + /// <summary> + /// 鍔犺浇浼犳劅鍣ㄥ垪琛� + /// </summary> + public class SensorView :FrameLayout + { + Button btnSensorValues; + Button btnLevel; + + 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")); + } + + + this.X = Application.GetRealWidth(7); + this.Width = Application.GetRealWidth(182); + this.Height = Application.GetRealWidth(124); + this.Y = Application.GetRealWidth(124 * (index / 2)); + this.Tag = sensorSPK; + + if (index % 2 != 0) + { + this.X = Application.GetRealWidth(189); + } + + + switch (sensorSPK) + { + case SPK.SensorCO2: + imagePath = "FunctionIcon/EnvirSensor/Co2Bg.png"; + iconPath = "FunctionIcon/EnvirSensor/Co2Icon.png"; + break; + case SPK.SensorPm25: + imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png"; + iconPath = "FunctionIcon/EnvirSensor/Pm25Icon.png"; + break; + case SPK.SensorTVOC: + imagePath = "FunctionIcon/EnvirSensor/TvocBg.png"; + iconPath = "FunctionIcon/EnvirSensor/TvocIcon.png"; + break; + case SPK.SensorHumidity: + imagePath = "FunctionIcon/EnvirSensor/HumidityBg.png"; + iconPath = "FunctionIcon/EnvirSensor/HumidityIcon.png"; + break; + case SPK.SensorTemperature: + 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; + } + } + + public void LoadView() + { + Function sensor = sensorList[0]; + this.BackgroundImagePath = imagePath; + + var btnIcon = new Button() + { + X = Application.GetRealWidth(23), + Y = Application.GetRealHeight(17), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = iconPath + }; + this.AddChidren(btnIcon); + + btnIcon.MouseUpEventHandler = (sender, e) => + { + #region + var esp = new EnvironmentalSensorPage(sensor,sensorList); + MainPage.BasePageView.AddChidren(esp); + esp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + #endregion + }; + + var btnInfoIcon = new Button() + { + X = Application.GetRealWidth(139), + Y = Application.GetRealHeight(21), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + UnSelectedImagePath = "FunctionIcon/EnvirSensor/InfoIcon.png", + }; + this.AddChidren(btnInfoIcon); + btnInfoIcon.MouseUpEventHandler = (sender, e) => + { + LoadInfo(sensorSPK); + }; + + var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); + var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); + btnLevel = new Button() + { + X = Application.GetRealWidth(25), + Y = Application.GetRealWidth(59), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(32), + TextAlignment = TextAlignment.CenterLeft, + TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1], + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = levelTextList[curLevel - 1], + Tag = "SensorLevel", + }; + this.AddChidren(btnLevel); + + btnLevel.MouseUpEventHandler = (sender, e) => + { + #region + var esp = new EnvironmentalSensorPage(sensor,sensorList); + MainPage.BasePageView.AddChidren(esp); + esp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + #endregion + }; + + + btnSensorValues = new Button() + { + X = Application.GetRealWidth(25), + Y = Application.GetRealWidth(83), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(27), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + IsBold = true, + Text = assembleValues.ToString(), + Tag = "SensorValues" + }; + this.AddChidren(btnSensorValues); + btnSensorValues.MouseUpEventHandler = (sender, e) => + { + #region + var esp = new EnvironmentalSensorPage(sensor,sensorList); + MainPage.BasePageView.AddChidren(esp); + esp.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + #endregion + }; + } + + + /// <summary> + /// 鍔犺浇浼犳劅鍣ㄧ瓑绾х浉鍏充俊鎭� + /// </summary> + void LoadInfo(string sensorSPK) + { + var levelColorList = sensorTemp.GetLevelColorList(sensorSPK); + var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); + Dialog dialog = new Dialog(); + + FrameLayout dialogBodyView = new FrameLayout(); + dialog.AddChidren(dialogBodyView); + dialogBodyView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + VerticalScrolViewLayout infoView = new VerticalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(667 - 94 - (levelColorList.Count * 44) - 20), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(94 + (levelColorList.Count * 44) + levelColorList.Count), + Radius = (uint)Application.GetRealWidth(12), + BackgroundColor = CSS_Color.MainBackgroundColor, + Animate = Animate.DownToUp, + ScrollEnabled = false, + AnimateSpeed = 0.3f, + }; + dialogBodyView.AddChidren(infoView); + + Button btnTitle = new Button() + { + Height = Application.GetRealHeight(50), + TextColor = CSS_Color.FirstLevelTitleColor, + IsBold = true, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.Center, + }; + infoView.AddChidren(btnTitle); + + switch (sensorSPK) + { + case SPK.SensorPm25: + btnTitle.Text = "PM2.5(ug/m虏)"; + break; + case SPK.SensorTemperature: + btnTitle.Text = Language.StringByID(StringId.Temp) + "(掳C)"; + break; + case SPK.SensorTVOC: + 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; + } + + FrameLayout subTitleView = new FrameLayout() + { + Height = Application.GetRealHeight(44), + }; + infoView.AddChidren(subTitleView); + + subTitleView.AddChidren(new Button() + { + X = Application.GetRealWidth(20), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + IsBold = true, + TextID = StringId.IntervalValue, + }); + + subTitleView.AddChidren(new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + IsBold = true, + TextID = StringId.LevelSensor, + }); + + subTitleView.AddChidren(new Button() + { + X = Application.GetRealWidth(223), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + IsBold = true, + TextID = StringId.ColorValue, + }); + for (int index = 0; index < levelTextList.Count; index++) + { + 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); + + 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(sensorSPK)[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() + { + X = Application.GetRealWidth(285), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(38), + Height = Application.GetRealHeight(18), + Radius = (uint)Application.GetRealWidth(4), + BackgroundColor = levelColorList[index] + }); + } + + + + + dialog.Show(); + } + + + + public void calculateAverage() + { + assembleValues = 0; + foreach (var s in sensorList) + { + assembleValues += Convert.ToDouble(s.GetAttrState("value")); + } + } + + /// <summary> + /// 鏇存柊鐘舵�� + /// </summary> + /// <param name="updateTemp"></param> + public void UpdataStatus(string spk ,string sid,string value) + { + try + { + if (spk == sensorSPK) + { + var temp = sensorList.Find((obj) => obj.sid == sid); + if(temp!= null) + { + temp.SetAttrState("value", value); + } + calculateAverage(); + + + btnSensorValues.Text = assembleValues.ToString(); + + var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); + + btnLevel.TextID = sensorTemp.GetLevelTextList(sensorSPK)[curLevel- 1]; + btnLevel.TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1]; + } + } + catch (Exception ex) + { + MainPage.Log($"鏇存柊鐜浼犳劅鍣ㄧ晫闈㈠紓甯�:{ex.Message}"); + } + } + + } + +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs index 5adc74f..adc01f9 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs @@ -26,6 +26,7 @@ Function function; List<Function> showFunctions; + List<Function> sensorList; /// <summary> /// 褰撳墠鏌ヨ绫诲瀷 /// </summary> @@ -45,6 +46,17 @@ { bodyView = this; function = ss; + showFunctions = new List<Function>(); + showFunctions.Add(ss); + sensorList = FunctionList.List.GetEnvirSensorsList(); + } + + + public EnvironmentalSensorPage(Function ss,List<Function> functions) + { + bodyView = this; + function = ss; + sensorList = functions; showFunctions = new List<Function>(); showFunctions.Add(ss); } @@ -644,9 +656,8 @@ bool initTitleButton = true; - var tempList = FunctionList.List.GetEnvirSensorsList(); - foreach (var tempSensor in tempList) + foreach (var tempSensor in sensorList) { if (tempSensor.sid == function.sid) { @@ -850,7 +861,7 @@ } var sensorType = sr.spk.Split(".")[1]; - var queryType = sr.GetAttrState("spk")==null? "value": sr.GetAttrState("spk"); + var queryType = sr.GetAttrState("spk").ToString(); var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, sr.deviceId, queryType); if (revertObj != null) diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs index d8c32aa..b5d660b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs @@ -63,7 +63,10 @@ view.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - btnLocationInfoRight.MouseUpEventHandler = eventHandler; + if (btnLocationInfoRight != null) + { + btnLocationInfoRight.MouseUpEventHandler = eventHandler; + } btnLocationValues.MouseUpEventHandler = eventHandler; } } -- Gitblit v1.8.0