From fdd5cb921b0783ed81c7c9fb3f8327e3f6905c40 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期二, 01 六月 2021 11:58:06 +0800 Subject: [PATCH] 1 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 94 ++++++++++++- HDL-ON_Android/Assets/Language.ini | 2 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs | 58 ++++--- HDL_ON/DAL/Mqtt/MqttClient.cs | 2 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 47 ++++++ HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs | 43 ++++- HDL-ON_iOS/Info.plist | 4 HDL-ON_iOS/Resources/Language.ini | 2 HDL_ON/Entity/Function/Function.cs | 24 --- HDL_ON/Common/R.cs | 4 HDL_ON/DAL/Server/HttpServerRequest.cs | 2 .vs/HDL_APP_Project/xs/UserPrefs.xml | 78 +--------- HDL_ON/DAL/DriverLayer/Control.cs | 8 + HDL_ON/UI/MainPage.cs | 2 HDL_ON/UI/UI1-Login/LoginPage.cs | 3 16 files changed, 228 insertions(+), 147 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index e2b0040..6ac6b28 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,81 +1,23 @@ -锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> +锘�<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/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control.cs"> <Files> - <File FileName="HDL_ON/DAL/Mqtt/MqttInfoConfig.cs" /> - <File FileName="HDL_ON/Common/FileUtlis.cs" /> - <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="630" Column="1" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" Line="851" Column="74" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" Line="694" Column="59" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/StbPage.cs" Line="529" Column="20" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/PjtPage.cs" Line="13" Column="25" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs" Line="348" Column="10" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="1054" Column="1" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs" Line="11" Column="9" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrLearnPage.cs" Line="1" Column="1" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs" Line="1" Column="1" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs" Line="256" Column="64" /> + <File FileName="HDL_ON/UI/MainPage.cs" Line="16" Column="17" /> + <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="108" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> - <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> - <Node name="DriverLayer" expanded="True" /> - <Node name="Mqtt" expanded="True" /> - <Node name="Server" expanded="True" /> - </Node> - <Node name="Entity" expanded="True"> - <Node name="Device" expanded="True" /> - <Node name="Enumerative" expanded="True" /> - <Node name="Function" expanded="True" /> - </Node> - <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True" /> - <Node name="UI0-Stan" expanded="True"> - <Node name="Form" expanded="True"> - <Node name="Base" expanded="True" /> - </Node> - </Node> - <Node name="UI2" expanded="True"> - <Node name="1-HomePage" expanded="True" /> - <Node name="2-Classification" expanded="True" /> - <Node name="FuntionControlView" expanded="True"> - <Node name="1ContorlPage" expanded="True" /> - <Node name="Electrical" expanded="True" /> - <Node name="Energy" expanded="True" /> - <Node name="EnvironmentalScience" expanded="True" /> - <Node name="Light" expanded="True" /> - <Node name="Music" expanded="True" /> - <Node name="Video" expanded="True" /> - <Node name="FunctionBaseInfoSetPage.cs" selected="True" /> - </Node> + <Node name="DriverLayer" expanded="True"> + <Node name="Control.cs" selected="True" /> </Node> </Node> + <Node name="Entity" expanded="True" /> </Node> - <Node name="HDL-ON_Android" expanded="True"> - <Node name="Assets" expanded="True"> - <Node name="Phone" expanded="True"> - <Node name="FunctionIcon" expanded="True"> - <Node name="Electrical" expanded="True" /> - </Node> - </Node> - </Node> - </Node> - <Node name="HDL-ON_iOS" expanded="True"> - <Node name="Resources" expanded="True"> - <Node name="Phone" expanded="True"> - <Node name="FunctionIcon" expanded="True"> - <Node name="Electrical" expanded="True" /> - <Node name="Icon" expanded="True"> - <Node name="HomeIcon" expanded="True" /> - </Node> - </Node> - </Node> - </Node> - </Node> + <Node name="HDL-ON_iOS" expanded="True" /> </Node> </State> </Pad> @@ -87,14 +29,12 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" line="34" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" line="313" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" line="392" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs" line="327" 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 f2c2ba9..c713329 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -445,6 +445,7 @@ 458=Date 459=Real time energy consumption 460=Energy consumption of this month +461=Indoor/Outdoor 1000=Room Humidity 1001=V-chip @@ -1246,6 +1247,7 @@ 458=鏃ユ湡 459=瀹炴椂鑳借�� 460=鏈湀鑳借�� +461=瀹ゅ唴/瀹ゅ 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index f0ad94e..42bae3b 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="202104282" android:versionName="1.2.202104282" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202105251" android:versionName="1.2.202105251" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!-- 鍙瀵硅鏉冮檺--> <uses-permission android:name="android.permission.CAMERA" /> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 3cf1a8d..50ba375 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -104,9 +104,9 @@ <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleShortVersionString</key> - <string>1.2.202104282</string> + <string>1.2.202105251</string> <key>CFBundleVersion</key> - <string>202104282</string> + <string>1.2.05251</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 f2c2ba9..c713329 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -445,6 +445,7 @@ 458=Date 459=Real time energy consumption 460=Energy consumption of this month +461=Indoor/Outdoor 1000=Room Humidity 1001=V-chip @@ -1246,6 +1247,7 @@ 458=鏃ユ湡 459=瀹炴椂鑳借�� 460=鏈湀鑳借�� +461=瀹ゅ唴/瀹ゅ 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 68c931e..3a5c9e3 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -5,6 +5,10 @@ public static class StringId { /// <summary> + /// 瀹ゅ唴瀹ゅ + /// </summary> + public const int InOutdoor = 461; + /// <summary> /// 鏈湀鑳借�� /// </summary> public const int EnergyConsumptionOfThisMonth = 460; diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 7127058..f66b0e0 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -812,6 +812,14 @@ case SPK.SensorTVOC: case SPK.SensorTemperature: case SPK.SensorHumidity: + if(localFunction.spk == SPK.SensorTemperature) + { + HomePage.LoadEvent_RefreshEnvirIndoorTemp(); + } + else if (localFunction.spk == SPK.SensorHumidity) + { + HomePage.LoadEvent_RefreshEnvirIndoorHumi(); + } EnvironmentalPage.LoadEvent_UpdataStatus(localFunction); break; case SPK.ElectricSocket: diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index be355ed..f1b92dd 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -821,7 +821,7 @@ /// <returns></returns> static async Task GetMqttInfoAndMQTTConnectAsync() { - var mqttInfoRequestResult_Obj = new Server.HttpServerRequest().GetMqttRemoteInfo(GetRandomKey()); + var mqttInfoRequestResult_Obj = new HttpServerRequest().GetMqttRemoteInfo(GetRandomKey()); if (mqttInfoRequestResult_Obj != null) { MqttInfoConfig.Current.mMqttInfo = mqttInfoRequestResult_Obj; diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 260643f..65389f4 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -86,7 +86,7 @@ d.Add("key", key); var requestJson = HttpUtil.GetSignRequestJson(d); - return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson); + return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_SensorLastMonthHistoricalData, requestJson); } diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 644e047..ce410b4 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1234,30 +1234,6 @@ /// </summary> public const string TvIr = "ir.tv"; /// <summary> - /// 绾㈠鎶曞奖浠� - /// </summary> - public const string PjtIr = "ir.pjt"; - /// <summary> - /// 绾㈠鏈洪《鐩� - /// </summary> - public const string StbIr = "ir.stb"; - /// <summary> - /// 绾㈠褰辩鏈� - /// </summary> - public const string DvDIr = "ir.dvd"; - /// <summary> - /// 绾㈠绌烘皵鍑�鍖栧櫒 - /// </summary> - public const string PurifierIr = "ir.air_purifier"; - /// <summary> - /// 绾㈠鐑按鍣� - /// </summary> - public const string HeaterIr = " ir.water_heater"; - /// <summary> - /// 绾㈠椋庢墖 - /// </summary> - public const string FanIr = "ir.fan"; - /// <summary> /// 瀹剁數銆侀鎵� /// </summary> public const string ElectricFan = "electrical.fan"; diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index 1315ac8..49c6d7e 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -20,7 +20,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "1.2.0428"; + public static string VersionString = "1.2.0525"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index bf0e438..b2a3213 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -199,7 +199,8 @@ //return; if (b) { - etAccount.Text = "13375012446";//娴嬭瘯鏈嶅姟鍣� + etAccount.Text = "15626203746";//娴嬭瘯鏈嶅姟鍣� + //etAccount.Text = "13375012446";//娴嬭瘯鏈嶅姟鍣� //etAccount.Text = "1033326940@qq.com"; //etAccount.Text = "18022428438";//wjc //etAccount.Text = "13602944661";//kx diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 6521986..1badfb1 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -35,13 +35,21 @@ /// </summary> FrameLayout environmentalView; /// <summary> - /// 褰撳墠娓╁害淇℃伅 + /// 褰撳墠娓╁害淇℃伅-瀹ゅ /// </summary> TextButton btnTempValues; /// <summary> - /// 褰撳墠婀垮害淇℃伅 + /// 褰撳墠婀垮害淇℃伅-瀹ゅ /// </summary> TextButton btnHumidityValues; + /// <summary> + /// 褰撳墠娓╁害淇℃伅-瀹ゅ唴 + /// </summary> + TextButton btnIndoorTempValues; + /// <summary> + /// 褰撳墠婀垮害淇℃伅-瀹ゅ唴 + /// </summary> + TextButton btnIndoorHumiValues; /// <summary> /// 褰撳墠pm2.5鐘舵�� /// </summary> @@ -184,9 +192,27 @@ }; topView.AddChidren(environmentalView); #region 鐜鏁版嵁 + var tempSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorTemperature); + var humiSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorHumidity); + + var btnEnvirValuesTitle = new Button() { + X = Application.GetRealWidth(12), + Gravity = Gravity.CenterVertical, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextID = StringId.InOutdoor, + TextAlignment = TextAlignment.CenterLeft, + }; + if (tempSensorList.Count > 0 || humiSensorList.Count > 0) + { + btnEnvirValuesTitle.Width = Application.GetRealWidth(8)+ btnEnvirValuesTitle.GetTextWidth(); + } + environmentalView.AddChidren(btnEnvirValuesTitle); + Button btnTempIcon = new Button() { - X = Application.GetRealWidth(12), + X = btnEnvirValuesTitle.Right,//+ Application.GetRealWidth(4), + //X = Application.GetRealWidth(12), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), @@ -197,18 +223,44 @@ btnTempValues = new TextButton() { X = btnTempIcon.Right + Application.GetRealWidth(4), - Width = Application.GetRealWidth(30), Gravity = Gravity.CenterVertical, TextColor = CSS_Color.MainBackgroundColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, Text = MainPage.cityInfo.temperature + "掳", TextAlignment = TextAlignment.CenterLeft, }; + btnTempValues.Width = btnTempValues.GetTextWidth(); environmentalView.AddChidren(btnTempValues); + + btnIndoorTempValues = new TextButton() + { + X = btnTempValues.Right, + Gravity = Gravity.CenterVertical, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = "/--掳", + }; + if (tempSensorList.Count > 0) + { + double tempTotalValues = 0; + foreach (var temp in tempSensorList) + { + double tempValue = 0; + double.TryParse(temp.GetAttrState(FunctionAttributeKey.Value), out tempValue); + tempTotalValues += tempValue; + } + if (tempTotalValues > 0) + { + btnIndoorTempValues.Text = "/" + tempTotalValues + "掳"; + } + btnIndoorTempValues.Width = btnIndoorTempValues.GetTextWidth(); + } + environmentalView.AddChidren(btnIndoorTempValues); Button btnHumidityIcon = new Button() { - X = btnTempValues.Right + Application.GetRealWidth(2), + X = btnIndoorTempValues.Right + Application.GetRealWidth(8), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), @@ -219,18 +271,44 @@ btnHumidityValues = new TextButton() { X = btnHumidityIcon.Right + Application.GetRealWidth(4), - Width = Application.GetRealWidth(30), Gravity = Gravity.CenterVertical, TextColor = CSS_Color.MainBackgroundColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, Text = MainPage.cityInfo.humidity + "%", TextAlignment = TextAlignment.CenterLeft, }; + btnHumidityValues.Width = btnHumidityValues.GetTextWidth(); environmentalView.AddChidren(btnHumidityValues); + + btnIndoorHumiValues = new TextButton() + { + X = btnHumidityValues.Right, + Gravity = Gravity.CenterVertical, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextAlignment = TextAlignment.CenterLeft, + Text = "/--%", + }; + if (tempSensorList.Count > 0) + { + double humiTotalValues = 0; + foreach (var humi in humiSensorList) + { + double humiValue = 0; + double.TryParse(humi.GetAttrState(FunctionAttributeKey.Value), out humiValue); + humiTotalValues += humiValue; + } + if (humiTotalValues > 0) + { + btnIndoorHumiValues.Text = "/" + humiTotalValues + "%"; + } + btnIndoorHumiValues.Width = btnIndoorHumiValues.GetTextWidth(); + } + environmentalView.AddChidren(btnIndoorHumiValues); Button btnPm25Icon = new Button() { - X = btnHumidityValues.Right + Application.GetRealWidth(2), + X = btnIndoorHumiValues.Right + Application.GetRealWidth(4), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), @@ -241,13 +319,13 @@ btnPm25Values = new TextButton() { X = btnPm25Icon.Right + Application.GetRealWidth(4), - Width = Application.GetRealWidth(130), Gravity = Gravity.CenterVertical, TextColor = CSS_Color.MainBackgroundColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, Text = MainPage.cityInfo.pm25, TextAlignment = TextAlignment.CenterLeft, }; + btnPm25Values.Width = btnPm25Values.GetTextWidth(); environmentalView.AddChidren(btnPm25Values); #endregion diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index f4596b8..79ccdd8 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -21,6 +21,53 @@ bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25; } } + + /// <summary> + /// 鏇存柊瀹ゅ唴浼犳劅鍣ㄦ暟鎹�-婀垮害 + /// </summary> + public static void LoadEvent_RefreshEnvirIndoorHumi() + { + if (bodyView != null) + { + var humiSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorHumidity); + double humiTotalValues = 0; + foreach (var temp in humiSensorList) + { + double humiValue = 0; + double.TryParse(temp.GetAttrState(FunctionAttributeKey.Value), out humiValue); + humiTotalValues += humiValue; + } + if (humiTotalValues > 0) + { + bodyView.btnIndoorHumiValues.Text = "/" + humiTotalValues + "%"; + } + bodyView.btnIndoorHumiValues.Width = bodyView.btnIndoorHumiValues.GetTextWidth(); + } + } + + /// <summary> + /// 鏇存柊瀹ゅ唴浼犳劅鍣ㄦ暟鎹�-鏅氱偣 + /// </summary> + public static void LoadEvent_RefreshEnvirIndoorTemp() + { + if (bodyView != null) + { + var tempSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorTemperature); + double tempTotalValues = 0; + foreach (var temp in tempSensorList) + { + double tempValue = 0; + double.TryParse(temp.GetAttrState(FunctionAttributeKey.Value), out tempValue); + tempTotalValues += tempValue; + } + if (tempTotalValues > 0) + { + bodyView.btnIndoorTempValues.Text = "/" + tempTotalValues + "掳"; + } + bodyView.btnIndoorTempValues.Width = bodyView.btnIndoorTempValues.GetTextWidth(); + } + } + /// <summary> /// 鏇存柊鍔熻兘鍒楄〃涓婚〉 /// </summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs index b5baaf1..9eb41d7 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs @@ -706,46 +706,52 @@ { 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)) + for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++) { - if (view.Tag.ToString() != sensorTag) + var sensorTag = updateTemp.sid; + var view = bodyView.sensorListView.GetChildren(i); + if (view.GetType() == typeof(FrameLayout)) { - continue; - } - for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++) - { - var btn = (view as FrameLayout).GetChildren(j); - if (btn.GetType() == typeof(Button)) + if (view.Tag.ToString() != sensorTag) { - if (btn.Tag != null) + 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}"); } }); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs index bbb692a..68f8232 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs @@ -257,13 +257,18 @@ }; energyView1.AddChidren(btnEnergyText1); + + double realTimePower = 0; + double.TryParse(function.GetAttrState(FunctionAttributeKey.Power), out realTimePower); + realTimePower /= 1000; + var energyValue1 = new Button() { Width = Application.GetRealWidth(355), TextAlignment = TextAlignment.CenterRight, TextSize = CSS_FontSize.TextFontSize, TextColor = CSS_Color.PromptingColor1, - Text = function.GetAttrState(FunctionAttributeKey.Power) + "kW", + Text = realTimePower + "kW", }; energyView1.AddChidren(energyValue1); @@ -296,7 +301,7 @@ }; energyView2.AddChidren(btnEnergyText2); - var energyValue2 = new Button() + var btnEnergyValue2 = new Button() { Width = Application.GetRealWidth(355), TextAlignment = TextAlignment.CenterRight, @@ -304,7 +309,7 @@ TextColor = CSS_Color.PromptingColor1, Text = "--kW", }; - energyView2.AddChidren(energyValue2); + energyView2.AddChidren(btnEnergyValue2); energyView2.AddChidren( new Button() @@ -316,26 +321,38 @@ Height = Application.GetRealHeight(1) }); - new System.Threading.Thread(() => { - var pm = new DAL.Server.HttpServerRequest(); - var data = pm.GetLastMonthHistory(function.deviceId,FunctionAttributeKey.TotalElectricity); - if(data!= null) + new System.Threading.Thread(() => + { + var pm = new HttpServerRequest(); + var data = pm.GetLastMonthHistory(function.deviceId, FunctionAttributeKey.TotalElectricity); + if (data != null) { - if(data.Code == StateCode.SUCCESS) + if (data.Code == StateCode.SUCCESS) { var dataPack = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(data.Data.ToString()); - if(dataPack!=null) + if (dataPack != null) { - var dataValue = dataPack.GetValue("property").ToString(); - if(!string.IsNullOrEmpty(dataValue)) + try { - btnEnergyText2.Text = dataValue + "kW"; + var dataValue = dataPack.GetValue("monthDiff").ToString(); + if (!string.IsNullOrEmpty(dataValue)) + { + Application.RunOnMainThread(() => + { + btnEnergyValue2.Text = dataValue + "kW鈥"; + }); + } + } + catch + { + } } } } - }) { IsBackground = true }.Start(); + }) + { IsBackground = true }.Start(); #endregion } -- Gitblit v1.8.0