From 8e940d7f0c873cfedf7f6d8c885be98b96f1d046 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 10 九月 2024 15:43:41 +0800 Subject: [PATCH] 金茂光伏,金茂热水器 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 21 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs | 16 HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs | 277 +++++- HDL_ON/UI/UI2/2-Classification/RoomPage.cs | 3 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 37 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs | 1 HDL-ON_iOS/AppDelegate.cs | 4 HDL-ON_iOS/Info.plist | 4 HDL_ON/Entity/Function/Function.cs | 5 HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs | 869 +++++++++++++-------- HDL_ON/DAL/Server/HttpUtil.cs | 12 HDL_ON/Entity/Room.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs | 632 ++++++++------ HDL_ON/DAL/DriverLayer/Control.cs | 3 HDL_ON/UI/MainPage.cs | 6 HDL_ON/UI/UI1-Login/LoginPage.cs | 24 HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs | 423 +++++----- SiriIntents/Server/HttpUtil.cs | 12 20 files changed, 1,471 insertions(+), 884 deletions(-) diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index a328a7f..295e909 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:versionName="2.5.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202409051"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.6.0" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202409101"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <!--绋嬪簭鍙互璇诲彇璁惧澶栭儴瀛樺偍绌洪棿(鍐呯疆SDcard鍜屽缃甋DCard)鐨勬枃浠讹紝鎴戠殑鏂囦欢绛�--> diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index e740d00..737cce7 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -271,14 +271,14 @@ AppDomain.CurrentDomain.UnhandledException += (sender, e) => { if(e.ExceptionObject is Exception exception) { - MainPage.Log("error","鏈鐞嗙殑寮傚父锛�" + exception.Message); + MainPage.Log("error", "鏈鐞嗙殑寮傚父锛�" + exception.Message + "\r\nStackTrace: " + exception.StackTrace); } }; TaskScheduler.UnobservedTaskException += (sender, e) => { if (e.Exception is Exception exception) { - MainPage.Log("error", "鏈鐞嗙殑寮傚父锛�" + exception.Message); + MainPage.Log("error", "鏈鐞嗙殑寮傚父锛�" + exception.Message + "\r\nStackTrace: " + exception.StackTrace); } }; #endregion diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index 855270a..a30b196 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -11,7 +11,7 @@ <key>CFBundleName</key> <string>On Pro</string> <key>CFBundleShortVersionString</key> - <string>2.5.0</string> + <string>2.6.0</string> <key>CFBundleURLTypes</key> <array> <dict> @@ -36,7 +36,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>2.5.0</string> + <string>2.6.0</string> <key>LSApplicationQueriesSchemes</key> <array> <string>weixinULAPI</string> diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 39db401..e66c1c3 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1363,6 +1363,9 @@ AcstParentPage.UpdateAcstSubInfo(localFunction); WaterHeaterJinmaoPage.UpdateStatus(); break; + case SPK.InverterJinmao: + InverterJinmaoPage.UpdateStatus(localFunction); + break; case SPK.AirSwitch: AirSwitchPage.UpdataState(localFunction); if (localFunction.GetAttribute(FunctionAttributeKey.Power) != null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰 diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index bac48c5..58c5a1c 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,13 +18,13 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - public const string APP_KEY = "HDL-HOME-APP"; - public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + //public const string APP_KEY = "HDL-HOME-APP"; + //public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; - //public const string APP_KEY = "HDL-HOME-APP-TEST"; - //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; + public const string APP_KEY = "HDL-HOME-APP-TEST"; + public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm //const string APP_KEY = "CPEVRLRT"; diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 646dfc2..aaa2157 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -296,6 +296,11 @@ /// 璁惧spk /// </summary> public string spk = ""; + /// <summary> + /// 鎵╁睍淇℃伅 + /// 瀛楃涓� + /// </summary> + public string extend = ""; private string _SpkCategory = string.Empty; /// <summary> diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs index 2516c3e..28a8ab6 100644 --- a/HDL_ON/Entity/Room.cs +++ b/HDL_ON/Entity/Room.cs @@ -285,7 +285,7 @@ } catch (Exception ex) { - MainPage.Log($"鍔熻兘鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}"); + MainPage.Log("Error",$"鍔熻兘鏁版嵁鍒濆鍖栧け璐ワ細{ex.StackTrace}"); } } return rooms; diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs index f3a9bf9..689a15c 100644 --- a/HDL_ON/UI/MainPage.cs +++ b/HDL_ON/UI/MainPage.cs @@ -26,7 +26,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string VersionString = "2.5.0"; + public static string VersionString = "2.6.0"; ///// <summary> ///// 瀹㈡埛绔被鍨� ///// </summary> @@ -149,6 +149,10 @@ _RoomNotSupportFunctionList.Add(SPK.ElectricEnergy); _RoomNotSupportFunctionList.Add(SPK.OtherCommon); _RoomNotSupportFunctionList.Add(SPK.SensorLight); + _RoomNotSupportFunctionList.Add(SPK.AcstParent); + _RoomNotSupportFunctionList.Add(SPK.AcstSub); + _RoomNotSupportFunctionList.Add(SPK.WaterHeaterJinmao); + _RoomNotSupportFunctionList.Add(SPK.InverterJinmao); _RoomNotSupportFunctionList.AddRange(SPK.EnvironDeviceSpkList()); //_RoomNotSupportFunctionList.AddRange(SPK.ArmSensorSpkList()); } diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 9bb5331..3efbe95 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -319,7 +319,8 @@ //etAccount.Text = "18402017839"; //etAccount.Text = "18620993214"; //etAccount.Text = "13414984501";//鍚存檽鑱� - + etAccount.Text = "13580507523"; + etAccount.Text = "18475593023"; } else { @@ -342,7 +343,7 @@ { etPassword.Text = "hdl1985."; } - else if (etAccount.Text == "13414984501") + else if (etAccount.Text == "18475593023") { etPassword.Text = "a123456"; } @@ -362,11 +363,10 @@ { etPassword.Text = "aa123456"; } - else if (etAccount.Text == "dcai.assist@gmail.com") + else if (etAccount.Text == "13580507523") { - etPassword.Text = "GraniteTileS57"; + etPassword.Text = "a123456"; } - //etPassword.Text = "Hdl85521566"; btnLogin.IsSelected = true; }; #endif @@ -1063,6 +1063,7 @@ FunctionList.List.Functions.Add(new Function { name = "娴嬭瘯-閲戣寕鍏変紡鍌ㄨ兘", + extend = "jinmaot1rue", spk = SPK.InverterJinmao, collect = true, attributes = new List<FunctionAttributes>() @@ -1080,9 +1081,9 @@ new FunctionAttributes(){key = InverterJinmao_AttrEnum.load_electricity_today.ToString(),value = new List<string>(){ "0" },curValue ="100",state = "100"}, new FunctionAttributes(){key = InverterJinmao_AttrEnum.load_electricity_month.ToString(),value = new List<string>(){ "0" },curValue ="200",state = "200"}, new FunctionAttributes(){key = InverterJinmao_AttrEnum.load_electricity.ToString(),value = new List<string>(){ "0" },curValue ="1000",state = "1000"}, - new FunctionAttributes(){key = InverterJinmao_AttrEnum.coal.ToString(),value = new List<string>(){ "0" },curValue ="100",state = "100"}, - new FunctionAttributes(){key = InverterJinmao_AttrEnum.co2.ToString(),value = new List<string>(){ "0" },curValue ="1000",state = "1000"}, - new FunctionAttributes(){key = InverterJinmao_AttrEnum.trees.ToString(),value = new List<string>(){ "0" },curValue ="10",state = "10"}, + new FunctionAttributes(){key = InverterJinmao_AttrEnum.coal.ToString(),value = new List<string>(){ "0" },curValue ="1021210",state = "1021210"}, + new FunctionAttributes(){key = InverterJinmao_AttrEnum.co2.ToString(),value = new List<string>(){ "0" },curValue ="1031300",state = "1031300"}, + new FunctionAttributes(){key = InverterJinmao_AttrEnum.trees.ToString(),value = new List<string>(){ "0" },curValue ="121310",state = "121310"}, } }); @@ -1090,6 +1091,7 @@ { name = "娴嬭瘯-绌鸿皟绉戞妧绯荤粺鎬绘帶", spk = SPK.AcstParent, + extend = "jinmaotrue", collect = true, attributes = new List<FunctionAttributes>() { @@ -1200,15 +1202,15 @@ attributes = new List<FunctionAttributes>() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, - new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.co2.ToString(),curValue = "52",state = "52" }, - new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.energy_electricity.ToString(),curValue = "100",state = "100" }, + new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.co2.ToString(),curValue = "522222",state = "522222" }, + new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.energy_electricity.ToString(),curValue = "144400",state = "144400" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.flow.ToString(),curValue = "2",state = "2" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.mode.ToString(),curValue = "economic",state = "economic" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.mode_free.ToString(),curValue = "true",state = "true" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.recycl_volume.ToString(),curValue = "10",state = "10" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.set_temp.ToString(),curValue = "25",state = "25" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.temp.ToString(),curValue = "23",state = "23" }, - new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.trees.ToString(),curValue = "8",state = "8" }, + new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.trees.ToString(),curValue = "11228",state = "11228" }, new FunctionAttributes(){ key = WaterHeaterJinmao_AttrEnum.volume.ToString(),curValue = "100",state = "100" }, }, diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index dd89adc..4284a3e 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -1765,7 +1765,8 @@ { X = Application.GetRealWidth(11), Y = Application.GetRealWidth(10), - TextID = StringId.Acst, + Text = function.name, + //TextID = StringId.Acst, IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, @@ -1784,6 +1785,22 @@ Height = Application.GetRealHeight(37), }; view.AddChidren(btnLogo); + + try + { + if (function.extend.Contains("jinmao") && function.extend.Contains("true")) + { + btnLogo.Visible = true; + } + else + { + btnLogo.Visible = false; + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕logo鏄剧ず澶勭悊寮傚父锛歿ex.Message}"); + } Button btnFunctionViewBg; btnFunctionViewBg = new Button() @@ -1805,7 +1822,7 @@ } else if (function.spk == SPK.InverterJinmao) { - btnName.TextID = StringId.NewEnergy; + //btnName.TextID = StringId.NewEnergy; btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { var page = new InverterJinmaoPage(); diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 1aa170b..876deaa 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using System.Security.Cryptography; using HDL_ON.DAL.Server; using HDL_ON.DriverLayer; using HDL_ON.Entity; @@ -1194,12 +1195,29 @@ Height = Application.GetRealWidth(57), }; functionView.AddChidren(btnJMLogo); - + if (item == ShowFunction.Acst) { btnName.TextID = StringId.Acst; + try + { + var acstFunction = FunctionList.List.GetAcstParentList()[0]; + btnName.Text = acstFunction.name; + if (acstFunction.extend.Contains("jinmao") && acstFunction.extend.Contains("true")) + { + btnJMLogo.Visible = true; + } + else + { + btnJMLogo.Visible = false; + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"鍔犺浇閲戣寕绉戞妧绯荤粺涓绘帶鍚嶇О寮傚父:{ex.Message}"); + } btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { var page = new AcstParentPage(); @@ -1211,6 +1229,23 @@ else if (item == ShowFunction.InverterJinmao) { btnName.TextID = StringId.NewEnergy; + try + { + var jinmaoInverterFunction = FunctionList.List.GetInverterJinmaoList()[0]; + btnName.Text = jinmaoInverterFunction.name; + if (jinmaoInverterFunction.extend.Contains("jinmao") && jinmaoInverterFunction.extend.Contains("true")) + { + btnJMLogo.Visible = true; + } + else + { + btnJMLogo.Visible = false; + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"鍔犺浇閲戣寕鍌ㄨ兘鍚嶇О寮傚父:{ex.Message}"); + } btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { var page = new InverterJinmaoPage(); diff --git a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs index 7bbf394..902fe8c 100644 --- a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs @@ -104,9 +104,6 @@ { continue; } -#if DEBUG - //throw new ArgumentNullException(); -#endif functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs index c4868c1..14282ac 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs @@ -1297,6 +1297,7 @@ { X = Application.GetRealWidth(18 + 7), Y = Application.GetRealHeight(11), + Width = Application.GetRealWidth(120), Height = Application.GetRealHeight(40), TextAlignment = TextAlignment.CenterLeft, TextColor = 0xFF1b3053, diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs index 18f467b..deace59 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs @@ -231,6 +231,8 @@ contentView.AddChidren(btnSetTempValues); #if __IOS__ bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); +#else + bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(5); #endif diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs index 4ebb060..f5ded51 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs @@ -217,7 +217,7 @@ echartOption1 = new EchartsOption_Histogram(); echartOption1.xTitle = "鏃堕棿"; - echartOption1.yTitle = "鐢甸噺锛坘w锛�"; + echartOption1.yTitle = "鐢甸噺锛坘wh锛�"; //echartOption.InitXdataText(new List<string>() //{ // "21","22","23","24","25","26","26","27","28","29", @@ -422,7 +422,7 @@ echartOption2 = new EchartsOption_Histogram(); echartOption2.xTitle = "鏃堕棿"; - echartOption2.yTitle = "鐢甸噺锛坘w锛�"; + echartOption2.yTitle = "鐢甸噺锛坘wh锛�"; //echartOption2.InitXdataText(new List<string>() //{ // "21","22","23","24","25","26","26","27","28","29", @@ -615,6 +615,7 @@ Application.RunOnMainThread(() => { + var ddd = echartOption2.InitOption(); infoView2_EchartsView.ShowWithOption(echartOption2.InitOption()); }); } @@ -647,7 +648,7 @@ var pvElecQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1); if (queryType1 == QueryType.day_hour) { - if (pvElecQueryDate.Year == 2023 && pvElecQueryDate.Month == 1 && pvElecQueryDate.Day == 1) + if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1 && pvElecQueryDate.Day == 1) { return; } @@ -656,16 +657,17 @@ } else if (queryType1 == QueryType.custom_month) { - if (pvElecQueryDate.Year == 2023 && pvElecQueryDate.Month == 1) + if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1) { return; } pvElecQueryDate = pvElecQueryDate.AddMonths(-1); + queryTime_Day1 = pvElecQueryDate.Day; infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM"); } else if (queryType1 == QueryType.custom_year) { - if (pvElecQueryDate.Year == 2023) + if (pvElecQueryDate.Year <= 2023) { return; } @@ -679,41 +681,38 @@ }; infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { - var tempQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1); + var pvElecQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1); if (queryType1 == QueryType.day_hour) { - if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day) + if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month && pvElecQueryDate.Day == DateTime.Now.Day) { return; } - tempQueryDate = tempQueryDate.AddDays(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + pvElecQueryDate = pvElecQueryDate.AddDays(1); + infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM-dd"); } else if (queryType1 == QueryType.custom_month) { - if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month) + if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month) { return; } - tempQueryDate = tempQueryDate.AddMonths(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM"); + pvElecQueryDate = pvElecQueryDate.AddMonths(1); + queryTime_Day1 = pvElecQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM"); } else if (queryType1 == QueryType.custom_year) { - if (tempQueryDate.Year == 2023) + if (pvElecQueryDate.Year >= DateTime.Now.Year) { return; } - if (tempQueryDate.Year == DateTime.Now.Year) - { - return; - } - tempQueryDate = tempQueryDate.AddYears(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy"); + pvElecQueryDate = pvElecQueryDate.AddYears(1); + infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy"); } - queryTime_Year1 = tempQueryDate.Year; - queryTime_Month1 = tempQueryDate.Month; - queryTime_Day1 = tempQueryDate.Day; + queryTime_Year1 = pvElecQueryDate.Year; + queryTime_Month1 = pvElecQueryDate.Month; + queryTime_Day1 = pvElecQueryDate.Day; getPvElectricityHistory(); }; @@ -727,6 +726,12 @@ infoView1_Date_Month.IsSelected = false; infoView1_Date_Year.IsSelected = false; queryType1 = QueryType.day_hour; + if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1)) + { + queryTime_Year1 = DateTime.Now.Year; + queryTime_Month1 = DateTime.Now.Month; + queryTime_Day1 = DateTime.Now.Day; + } infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd"); getPvElectricityHistory(); }; @@ -740,6 +745,11 @@ infoView1_Date_Month.IsSelected = true; infoView1_Date_Year.IsSelected = false; queryType1 = QueryType.custom_month; + if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1)) + { + queryTime_Year1 = DateTime.Now.Year; + queryTime_Month1 = DateTime.Now.Month; + } infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM"); getPvElectricityHistory(); }; @@ -766,7 +776,7 @@ var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2); if (queryType2 == QueryType.day_hour) { - if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) + if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) { return; } @@ -775,16 +785,17 @@ } else if (queryType2 == QueryType.custom_month) { - if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1) + if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1) { return; } waterQueryDate = waterQueryDate.AddMonths(-1); + queryTime_Day2 = waterQueryDate.Day; infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); } else if (queryType2 == QueryType.custom_year) { - if (waterQueryDate.Year == 2023) + if (waterQueryDate.Year <= 2023) { return; } @@ -815,15 +826,12 @@ return; } waterQueryDate = waterQueryDate.AddMonths(1); + queryTime_Day2 = waterQueryDate.Day; infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); } else if (queryType2 == QueryType.custom_year) { - if (waterQueryDate.Year == 2023) - { - return; - } - if (waterQueryDate.Year == DateTime.Now.Year) + if (waterQueryDate.Year >= DateTime.Now.Year) { return; } @@ -845,6 +853,12 @@ infoView2_Date_Month.IsSelected = false; infoView2_Date_Year.IsSelected = false; queryType2 = QueryType.day_hour; + if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2)) + { + queryTime_Year2 = DateTime.Now.Year; + queryTime_Month2 = DateTime.Now.Month; + queryTime_Day2 = DateTime.Now.Day; + } infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd"); getLoadElectricityHistory(); }; @@ -858,6 +872,11 @@ infoView2_Date_Month.IsSelected = true; infoView2_Date_Year.IsSelected = false; queryType2 = QueryType.custom_month; + if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2)) + { + queryTime_Year2 = DateTime.Now.Year; + queryTime_Month2 = DateTime.Now.Month; + } infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM"); getLoadElectricityHistory(); }; @@ -990,6 +1009,19 @@ }; topView.AddChidren(btnConfrim); + var btnToday = new Button() + { + X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + Visible = false, + Enable = false, + Text = "浠婃棩", + }; + topView.AddChidren(btnToday); + UIPickerView uIPickerView = new UIPickerView() { Y = Application.GetRealHeight(40), @@ -1015,6 +1047,10 @@ }; uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { + if (int1 < 0) + { + int1 = 1; + } if (pickerItems_Year[int1] != item1.ToString()) { int.TryParse(pickerItems_Year[int1], out item1); @@ -1066,7 +1102,7 @@ } if (pickerItems_Month != null) { - if (int2 > pickerItems_Month.Count) + if (int2 >= pickerItems_Month.Count || int2 < 0) { int2 = 0; } @@ -1093,16 +1129,22 @@ } } } - - uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); - uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), - pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), - pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + try + { + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鍘嗗彶鏁版嵁鎺т欢寮傚父:{ex.Message}"); + } } } if (pickerItems_Day != null) { - if (int3 >= pickerItems_Day.Count) + if (int3 >= pickerItems_Day.Count || int3 < 0) { int3 = 0; } @@ -1123,7 +1165,7 @@ { queryTime_Month1 = item2; } - infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM"); + infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, 1).ToString("yyyy-MM"); if (queryType1 == QueryType.day_hour) { if (item3 != queryTime_Day1) @@ -1136,6 +1178,73 @@ getPvElectricityHistory(); }; + + if (queryType1 == QueryType.day_hour) + { + try + { + btnToday.Visible = btnToday.Enable = true; + btnToday.MouseUpEventHandler = (sender, e) => + { + pickerItems_Year = new List<string>(); + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (queryTime_Year1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType1 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (queryTime_Month1 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year1, queryTime_Month1); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + item3 = queryTime_Day1 = DateTime.Now.Day; + item2 = queryTime_Month1 = DateTime.Now.Month; + item1 = queryTime_Year1 = DateTime.Now.Year; + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month1.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day1.ToString())); + }; + } + catch { } + } } public void SetWaterQureyDateDialog() @@ -1274,6 +1383,10 @@ }; uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { + if (int1 < 0) + { + int1 = 0; + } if (pickerItems_Year[int1] != item1.ToString()) { int.TryParse(pickerItems_Year[int1], out item1); @@ -1325,7 +1438,7 @@ } if (pickerItems_Month != null) { - if (int2 > pickerItems_Month.Count) + if (int2 > pickerItems_Month.Count || int2 < 0) { int2 = 0; } @@ -1361,7 +1474,7 @@ } if (pickerItems_Day != null) { - if (int3 >= pickerItems_Day.Count) + if (int3 >= pickerItems_Day.Count || int3 < 0) { int3 = 0; } @@ -1382,7 +1495,7 @@ { queryTime_Month2 = item2; } - infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM"); + infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, 1).ToString("yyyy-MM"); if (queryType2 == QueryType.day_hour) { if (item3 != queryTime_Day2) @@ -1395,9 +1508,91 @@ getLoadElectricityHistory(); }; + var btnToday = new Button() + { + X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + Visible = false, + Enable = false, + Text = "浠婃棩", + }; + topView.AddChidren(btnToday); + + + if (queryType2 == QueryType.day_hour) + { + try + { + btnToday.Visible = btnToday.Enable = true; + btnToday.MouseUpEventHandler = (sender, e) => + { + pickerItems_Year = new List<string>(); + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (queryTime_Year2 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType2 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (queryTime_Month2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year2, queryTime_Month2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + item3 = queryTime_Day2 = DateTime.Now.Day; + item2 = queryTime_Month2 = DateTime.Now.Month; + item1 = queryTime_Year2 = DateTime.Now.Year; + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year2.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day2.ToString())); + }; + } + catch { } + } + } + } } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs index 5345a30..b5397a1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs @@ -10,7 +10,7 @@ { public class InverterJinmaoPage : FrameLayout { - FrameLayout bodyView; + static InverterJinmaoPage bodyView; Function function; /// <summary> /// 浠婃棩鍙戠數閲忔暟鎹寜閽� @@ -39,7 +39,7 @@ /// <summary> /// 鍏変紡杩愯鐘舵�佸浘鏍囨寜閽� /// </summary> - Button pvRunStatus_IconButtonp; + Button pvRunStatus_IconButton; /// <summary> /// 鍏変紡杩愯鐘舵�佹枃鏈寜閽� /// </summary> @@ -63,7 +63,7 @@ /// <summary> /// 鍏変紡鐘舵�佷粖鏃ョ敤鐢甸噺鏁版嵁鎸夐挳 /// </summary> - Button loadElec_TodayTextButton; + Button powerUsage_TodayValuesButton; /// <summary> /// 鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺鏁版嵁鎸夐挳 /// </summary> @@ -203,7 +203,7 @@ #if __IOS__ pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft; - pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(6); + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8); #else pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft; pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37); @@ -213,12 +213,12 @@ { Y = Application.GetRealWidth(43), Height = Application.GetRealWidth(17), - Text = "kw", + Text = "kwh", TextColor = CSS_Color.MainBackgroundColor, TextSize = 12, TextAlignment = TextAlignment.CenterLeft, }; - pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right; + pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right - Application.GetRealWidth(2); electricityGenerationView.AddChidren(pvGenerate_todayUintButton); pvGenerate_TotalValuesButton = new Button() @@ -276,7 +276,7 @@ { Y = Application.GetRealWidth(43), Height = Application.GetRealWidth(17), - Text = "kw", + Text = "kwh", TextColor = CSS_Color.MainBackgroundColor, TextSize = 12, TextAlignment = TextAlignment.CenterRight, @@ -377,7 +377,7 @@ }; pvEleGenerationInfoView.AddChidren(pvRunStatusInfoView); - pvRunStatus_IconButtonp = new Button() + pvRunStatus_IconButton = new Button() { X = Application.GetRealWidth(8 + 14), Gravity = Gravity.CenterVertical, @@ -385,7 +385,7 @@ Height = Application.GetRealWidth(12), UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png", }; - pvRunStatusInfoView.AddChidren(pvRunStatus_IconButtonp); + pvRunStatusInfoView.AddChidren(pvRunStatus_IconButton); pvRunStatus_TextButton = new Button() { @@ -417,20 +417,21 @@ try { int index = 1; + float pvPower = 0.00f; while (index < 361) { - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()) == "0") + float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()), out pvPower); + if (pvPower > 0.00f) { - continue; - } - Application.RunOnMainThread(() => - { - powerGenerationBg.SetRotation(1f * index++); - }); - System.Threading.Thread.Sleep(50); - if (index == 361) - { - index = 1; + Application.RunOnMainThread(() => + { + powerGenerationBg.SetRotation(1f * index++); + }); + System.Threading.Thread.Sleep(50); + if (index == 361) + { + index = 1; + } } } } @@ -465,7 +466,7 @@ Y = Application.GetRealWidth(78), //Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(25), - Text = "瀹炴椂鍙戠數鍔熺巼 (kwh)", + Text = "瀹炴椂鍙戠數鍔熺巼 (kw)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -494,7 +495,7 @@ Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "浠婃棩鍙戠數閲� (kw)", + Text = "浠婃棩鍙戠數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -523,7 +524,7 @@ Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "鏈湀鍙戠數閲� (kw)", + Text = "鏈湀鍙戠數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -552,7 +553,7 @@ Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "鏈勾鍙戠數閲� (kw)", + Text = "鏈勾鍙戠數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -563,7 +564,7 @@ try { var revertObj = new HttpServerRequest().GetSensorHistory("custom_year", - function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), DateTime.Now.Year.ToString()); + function.deviceId, InverterJinmao_AttrEnum.pv_electricity.ToString(), DateTime.Now.Year.ToString()); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -643,20 +644,21 @@ try { int index = 1; + float loadPower = 0.00f; while (index < 361) { - if (function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()) == "0") + float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()), out loadPower); + if (loadPower > 0.00f) { - continue; - } - Application.RunOnMainThread(() => - { - powerUsageBg.SetRotation(1f * index++); - }); - System.Threading.Thread.Sleep(50); - if (index == 361) - { - index = 1; + Application.RunOnMainThread(() => + { + powerUsageBg.SetRotation(1f * index++); + }); + System.Threading.Thread.Sleep(50); + if (index == 361) + { + index = 1; + } } } } @@ -687,7 +689,7 @@ Y = Application.GetRealWidth(78), //Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(25), - Text = "瀹炴椂鐢ㄧ數鍔熺巼 (kwh)", + Text = "瀹炴椂鐢ㄧ數鍔熺巼 (kw)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -695,7 +697,7 @@ powerUsageView.AddChidren(powerUsage_TextButton); - var powerUsage_TodayValuesButton = new Button() + powerUsage_TodayValuesButton = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(191), @@ -709,13 +711,13 @@ }; electricityUsageStatusView.AddChidren(powerUsage_TodayValuesButton); - loadElec_TodayTextButton = new Button() + var loadElec_TodayTextButton = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "浠婃棩鐢ㄧ數閲� (kw)", + Text = "浠婃棩鐢ㄧ數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -742,7 +744,7 @@ Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "鏈湀鐢ㄧ數閲� (kw)", + Text = "鏈湀鐢ㄧ數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, @@ -770,189 +772,236 @@ Y = Application.GetRealWidth(220), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(17), - Text = "鏈勾鐢ㄧ數閲� (kw)", + Text = "鏈勾鐢ㄧ數閲� (kwh)", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.TextualColor, TextSize = 12, }; electricityUsageStatusView.AddChidren(powerUsage_YearTextButton); + + + new System.Threading.Thread(() => + { + try + { + var revertObj = new HttpServerRequest().GetSensorHistory("custom_year", + function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), DateTime.Now.Year.ToString()); + if (revertObj != null) + { + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); + double totalValues = 0.0; + double values = 0.0; + foreach (var data in revertData) + { + double.TryParse(data.fieldValue, out values); + totalValues += values; + } + Application.RunOnMainThread(() => + { + powerUsage_YearValuesButton.Text = totalValues.ToString(); + while (true) + { + if (powerUsage_YearValuesButton.Width < powerUsage_YearValuesButton.GetTextWidth()) + { + powerUsage_YearValuesButton.TextSize--; + } + else + { + break; + } + } + }); + } + } + } + catch (Exception ex) + { + MainPage.Log("Error", "璇诲彇閲戣寕鏈勾鍙戠數閲忔暟鎹紓甯革細" + ex.Message); + } + }) + { IsBackground = true }.Start(); + #endregion #endregion - contentView.AddChidren(new Button() + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) { - Height = Application.GetRealWidth(8) - }); + contentView.AddChidren(new Button() + { + Height = Application.GetRealWidth(8) + }); - #region 鍌ㄨ兘杩愯鐘舵�� Energy storage - var esRunStatus_TitleButton = new Button() - { - X = Application.GetRealWidth(16), - Height = Application.GetRealWidth(47), - TextAlignment = TextAlignment.CenterLeft, - Text = "鍌ㄨ兘杩愯鐘舵��", - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = 16, - IsBold = true, - }; - contentView.AddChidren(esRunStatus_TitleButton); + #region 鍌ㄨ兘杩愯鐘舵�� Energy storage + var esRunStatus_TitleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(47), + TextAlignment = TextAlignment.CenterLeft, + Text = "鍌ㄨ兘杩愯鐘舵��", + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 16, + IsBold = true, + }; + contentView.AddChidren(esRunStatus_TitleButton); - #region - var esStatusView = new FrameLayout() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(343), - Height = Application.GetRealWidth(194), - BackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealHeight(12), - BorderColor = 0x00FFFFFF, - BorderWidth = 0, - }; - contentView.AddChidren(esStatusView); + #region + var esStatusView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(194), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealHeight(12), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + }; + contentView.AddChidren(esStatusView); - esStatus_InfoView = new FrameLayout() - { - X = 0 - Application.GetRealWidth(14), - Y = Application.GetRealWidth(12), - Width = Application.GetRealWidth(68 + 14), - Height = Application.GetRealWidth(28), - BackgroundColor = 0x1500C22D, - Radius = (uint)Application.GetRealHeight(14), - BorderColor = 0x00FFFFFF, - BorderWidth = 0, - }; - esStatusView.AddChidren(esStatus_InfoView); + esStatus_InfoView = new FrameLayout() + { + X = 0 - Application.GetRealWidth(14), + Y = Application.GetRealWidth(12), + Width = Application.GetRealWidth(68 + 14), + Height = Application.GetRealWidth(28), + BackgroundColor = 0x1500C22D, + Radius = (uint)Application.GetRealHeight(14), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + }; + esStatusView.AddChidren(esStatus_InfoView); - esRunStatus_Info_IconButton = new Button() - { - X = Application.GetRealWidth(8 + 14), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(12), - Height = Application.GetRealWidth(12), - UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png", - }; - esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton); + esRunStatus_Info_IconButton = new Button() + { + X = Application.GetRealWidth(8 + 14), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(12), + Height = Application.GetRealWidth(12), + UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png", + }; + esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton); - esRunStatus_Info_TextButton = new Button() - { - X = Application.GetRealWidth(8 + 14 + 4 + 12), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - TextColor = 0xFF00C22D, - Text = "鍏呯數", - }; - esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton); + esRunStatus_Info_TextButton = new Button() + { + X = Application.GetRealWidth(8 + 14 + 4 + 12), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + TextColor = 0xFF00C22D, + Text = "鍏呯數", + }; + esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton); - esRunStatus_BatteryValuesButton = new Button() - { - Y = Application.GetRealWidth(18), - Height = Application.GetRealWidth(17), - TextAlignment = TextAlignment.CenterRight, - Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%", - TextSize = 12, - TextColor = 0xFF00C22D, - }; - esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8); - esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width; - esStatusView.AddChidren(esRunStatus_BatteryValuesButton); + esRunStatus_BatteryValuesButton = new Button() + { + Y = Application.GetRealWidth(18), + Height = Application.GetRealWidth(17), + TextAlignment = TextAlignment.CenterRight, + Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%", + TextSize = 12, + TextColor = 0xFF00C22D, + }; + esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8); + esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width; + esStatusView.AddChidren(esRunStatus_BatteryValuesButton); - esRunStatus_BatteryIconButton = new Button() - { - X = Application.GetRealWidth(343 - 12 - 20) - esRunStatus_BatteryValuesButton.Width, - Y = Application.GetRealWidth(16), - Width = Application.GetRealWidth(20), - Height = Application.GetRealWidth(20), - UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png", - SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png", - IsSelected = esRunStatus_BatteryValuesButton.Text == "100%" - }; - esStatusView.AddChidren(esRunStatus_BatteryIconButton); + esRunStatus_BatteryIconButton = new Button() + { + X = Application.GetRealWidth(343 - 12 - 20) - esRunStatus_BatteryValuesButton.Width, + Y = Application.GetRealWidth(16), + Width = Application.GetRealWidth(20), + Height = Application.GetRealWidth(20), + UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png", + SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png", + IsSelected = esRunStatus_BatteryValuesButton.Text == "100%" + }; + esStatusView.AddChidren(esRunStatus_BatteryIconButton); - var esRunStatus_ValuesInfoView = new FrameLayout() - { - Width = Application.GetRealWidth(282), - Height = Application.GetRealWidth(153), - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealWidth(40), - BackgroundImagePath = "FunctionIcon/Acst/Inverter/EnergyStorageStatusBg.png", - }; - esStatusView.AddChidren(esRunStatus_ValuesInfoView); + var esRunStatus_ValuesInfoView = new FrameLayout() + { + Width = Application.GetRealWidth(282), + Height = Application.GetRealWidth(153), + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealWidth(40), + BackgroundImagePath = "FunctionIcon/Acst/Inverter/EnergyStorageStatusBg.png", + }; + esStatusView.AddChidren(esRunStatus_ValuesInfoView); - #region 瀹炴椂鍏呯數鍔熺巼 - var esRunStatus_ChargeValuesView = new FrameLayout() - { - X = Application.GetRealWidth(15), - Width = Application.GetRealWidth(128), - Height = Application.GetRealWidth(128), - }; - esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView); + #region 瀹炴椂鍏呯數鍔熺巼 + var esRunStatus_ChargeValuesView = new FrameLayout() + { + X = Application.GetRealWidth(15), + Width = Application.GetRealWidth(128), + Height = Application.GetRealWidth(128), + }; + esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView); - esRunStatus_ChargeValuesButton = new Button() - { - Y = Application.GetRealWidth(36), - Height = Application.GetRealWidth(32), - TextAlignment = TextAlignment.Center, - Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = 24, - IsBold = true, - }; - esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeValuesButton); + esRunStatus_ChargeValuesButton = new Button() + { + Y = Application.GetRealWidth(36), + Height = Application.GetRealWidth(32), + TextAlignment = TextAlignment.Center, + Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 24, + IsBold = true, + }; + esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeValuesButton); - var esRunStatus_ChargeTextButton = new Button() - { - X = Application.GetRealWidth(1), - Y = Application.GetRealWidth(76), - Height = Application.GetRealWidth(17), - TextAlignment = TextAlignment.Center, - Text = "瀹炴椂鍏呯數鍔熺巼(kwh)", - TextColor = CSS_Color.TextualColor, - TextSize = 12, - }; - esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton); - #endregion + var esRunStatus_ChargeTextButton = new Button() + { + X = Application.GetRealWidth(1), + Y = Application.GetRealWidth(76), + Height = Application.GetRealWidth(17), + TextAlignment = TextAlignment.Center, + Text = "瀹炴椂鍏呯數鍔熺巼(kw)", + TextColor = CSS_Color.TextualColor, + TextSize = 12, + }; + esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton); + #endregion - #region 瀹炴椂鐢ㄧ數鍔熺巼 - var esRunStatus_DischargeValuesView = new FrameLayout() - { - X = Application.GetRealWidth(132+13), - Width = Application.GetRealWidth(128), - Height = Application.GetRealWidth(128), - }; - esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView); + #region 瀹炴椂鐢ㄧ數鍔熺巼 + var esRunStatus_DischargeValuesView = new FrameLayout() + { + X = Application.GetRealWidth(132 + 13), + Width = Application.GetRealWidth(128), + Height = Application.GetRealWidth(128), + }; + esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView); - esRunStatus_DischargeValuesButton = new Button() - { - Y = Application.GetRealWidth(36), - Height = Application.GetRealWidth(32), - TextAlignment = TextAlignment.Center, - Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = 24, - IsBold = true, - }; - esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeValuesButton); + esRunStatus_DischargeValuesButton = new Button() + { + Y = Application.GetRealWidth(36), + Height = Application.GetRealWidth(32), + TextAlignment = TextAlignment.Center, + Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()), + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = 24, + IsBold = true, + }; + esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeValuesButton); - var esRunStatus_DischargeTextButton = new Button() - { - X = Application.GetRealWidth(1), - Y = Application.GetRealWidth(76), - Height = Application.GetRealWidth(17), - TextAlignment = TextAlignment.Center, - Text = "瀹炴椂鏀剧數鍔熺巼(kwh)", - TextColor = CSS_Color.TextualColor, - TextSize = 12, - }; - esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeTextButton); - #endregion + var esRunStatus_DischargeTextButton = new Button() + { + X = Application.GetRealWidth(1), + Y = Application.GetRealWidth(76), + Height = Application.GetRealWidth(17), + TextAlignment = TextAlignment.Center, + Text = "瀹炴椂鏀剧數鍔熺巼(kwh)", + TextColor = CSS_Color.TextualColor, + TextSize = 12, + }; + esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeTextButton); + #endregion + #endregion + #endregion - #endregion - - #endregion + } contentView.AddChidren(new Button() { @@ -1026,6 +1075,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.BottomLeft, }; +#if __IOS__ + socialContribution_Info1_UintButton.Y = Application.GetRealWidth(66); +#endif socialContribution_InfoView_1.AddChidren(socialContribution_Info1_UintButton); var socialContribution_Info1_TipButton = new Button() @@ -1092,6 +1144,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.BottomLeft, }; +#if __IOS__ + socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66); +#endif socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton); var socialContribution_Info2_TipButton = new Button() @@ -1158,6 +1213,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.BottomLeft, }; + #if __IOS__ + socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66); + #endif socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton); var socialContribution_Info3_TipButton = new Button() @@ -1184,7 +1242,7 @@ /// 鏇存柊鐣岄潰鏁版嵁 /// </summary> /// <param name="temp"></param> - public void UpdateStatus(Function temp) + public static void UpdateStatus(Function temp) { if (bodyView == null) { @@ -1195,38 +1253,38 @@ try { /// 鏇存柊浠婃棩鍙戠數閲� - upatePvGenerateTodayValues(); + bodyView.upatePvGenerateTodayValues(); /// 鏇存柊绱鍙戠數閲� - upatePvGenerateTotalValues(); + bodyView.upatePvGenerateTotalValues(); /// 鏇存柊浠婃棩鐢ㄧ數閲� - upatePvLoadTodayValues(); + bodyView.upatePvLoadTodayValues(); /// 鏇存柊绱鐢ㄧ數閲� - upatePvLoadTotalValues(); + bodyView.upatePvLoadTotalValues(); /// 鏇存柊鍏変紡杩愯鐘舵�� - upatePvRunStatus(); + bodyView.upatePvRunStatus(); /// 鏇存柊鍏変紡鍙戠數鍔熺巼 - updatePvPower(); + bodyView.updatePvPower(); /// 鏇存柊鍏変紡鏈湀鍙戠數閲� - upatePvGenerateMonthValues(); + bodyView.upatePvGenerateMonthValues(); /// 鏇存柊鍏変紡鐢ㄧ數鍔熺巼 - updateLoadElec(); + bodyView.updateLoadElec(); ///鏇存柊鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺 - updateLoadElecMonthValues(); + bodyView.updateLoadElecMonthValues(); //鏇存柊鍌ㄨ兘杩愯鐘舵�� - updateEsRunStates(); + bodyView.updateEsRunStates(); //鏇存柊鍌ㄨ兘鐢垫睜鐧惧垎姣� - updateEsBatterySoc(); + bodyView.updateEsBatterySoc(); //鏇存柊鍌ㄨ兘瀹炴椂鍏呯數鐘舵�� - updateEsCharge(); + bodyView.updateEsCharge(); //鏇存柊鍌ㄨ兘瀹炴椂鏀剧數鐘舵�� - updateEsDischarge(); - updateSocialContribution1(); - updateSocialContribution2(); - updateSocialContribution3(); + bodyView.updateEsDischarge(); + bodyView.updateSocialContribution1(); + bodyView.updateSocialContribution2(); + bodyView.updateSocialContribution3(); } catch (Exception ex) { - MainPage.Log("Error", $"閲戣寕鍏変紡鏇存柊寮傚父:{ex.Message}"); + MainPage.Log("Error", $"閲戣寕鍏変紡鏇存柊寮傚父:{ex.StackTrace}"); } }); } @@ -1251,14 +1309,14 @@ /// </summary> private void upatePvGenerateTotalValues() { - pvGenerate_TodayValuesButton.Text = "绱鍙戠數閲忥細" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()); + pvGenerate_TotalValuesButton.Text = "绱鍙戠數閲�:" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()); } /// <summary> /// 鏇存柊浠婃棩鐢ㄧ數閲� /// </summary> private void upatePvLoadTodayValues() { - pvLoad_TodayValuesButton.Text = loadElec_TodayTextButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()); + pvLoad_TodayValuesButton.Text = powerUsage_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()); } /// <summary> /// 鏇存柊鏈湀鐢ㄧ數閲� @@ -1284,19 +1342,19 @@ { case "run": pvRunStatusInfoView.BackgroundColor = 0x154484F4; - pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png"; + pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png"; pvRunStatus_TextButton.Text = "杩愯"; pvRunStatus_TextButton.TextColor = 0xFF4484F4; break; case "fault": pvRunStatusInfoView.BackgroundColor = 0x15FF4747; - pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconFault.png"; + pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconFault.png"; pvRunStatus_TextButton.Text = "鏁呴殰"; pvRunStatus_TextButton.TextColor = 0xFFFF4747; break; case "standby": pvRunStatusInfoView.BackgroundColor = 0x15798394; - pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconStandby.png"; + pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconStandby.png"; pvRunStatus_TextButton.Text = "寰呮満"; pvRunStatus_TextButton.TextColor = 0xFF798394; break; @@ -1322,40 +1380,43 @@ /// </summary> private void updateEsRunStates() { - switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString())) + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) { - case "charge": - esStatus_InfoView.BackgroundColor = 0x1500C22D; - esRunStatus_BatteryValuesButton.TextColor = 0xFF00C22D; - esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png"; - esRunStatus_Info_TextButton.Text = "鍏呯數"; - esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png"; - esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png"; - break; - case "discharge": - esStatus_InfoView.BackgroundColor = 0x15FC9C04; - esRunStatus_BatteryValuesButton.TextColor = 0xFFFC9C04; - esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconDischarge.png"; - esRunStatus_Info_TextButton.Text = "鏀剧數"; - esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg.png"; - esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg100.png"; - break; - case "shutdown": - esStatus_InfoView.BackgroundColor = 0x15798394; - esRunStatus_BatteryValuesButton.TextColor = 0xFF798394; - esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconShutdown.png"; - esRunStatus_Info_TextButton.Text = "鍋滄満"; - esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown.png"; - esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown100.png"; - break; - case "fault": - esStatus_InfoView.BackgroundColor = 0x15FF4747; - esRunStatus_BatteryValuesButton.TextColor = 0xFFFF4747; - esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconFault.png"; - esRunStatus_Info_TextButton.Text = "鏁呴殰"; - esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault.png"; - esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault100.png"; - break; + switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString())) + { + case "charge": + esStatus_InfoView.BackgroundColor = 0x1500C22D; + esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF00C22D; + esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png"; + esRunStatus_Info_TextButton.Text = "鍏呯數"; + esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png"; + esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png"; + break; + case "discharge": + esStatus_InfoView.BackgroundColor = 0x15FC9C04; + esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFC9C04; + esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconDischarge.png"; + esRunStatus_Info_TextButton.Text = "鏀剧數"; + esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg.png"; + esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg100.png"; + break; + case "shutdown": + esStatus_InfoView.BackgroundColor = 0x15798394; + esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF798394; + esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconShutdown.png"; + esRunStatus_Info_TextButton.Text = "鍋滄満"; + esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown.png"; + esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown100.png"; + break; + case "fault": + esStatus_InfoView.BackgroundColor = 0x15FF4747; + esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFF4747; + esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconFault.png"; + esRunStatus_Info_TextButton.Text = "鏁呴殰"; + esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault.png"; + esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault100.png"; + break; + } } } /// <summary> @@ -1363,10 +1424,13 @@ /// </summary> private void updateEsBatterySoc() { - esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%"; - if(esRunStatus_BatteryIconButton.Text == "100%") + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) { - esRunStatus_BatteryIconButton.IsSelected = true; + esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%"; + if (esRunStatus_BatteryIconButton.Text == "100%") + { + esRunStatus_BatteryIconButton.IsSelected = true; + } } } /// <summary> @@ -1374,51 +1438,59 @@ /// </summary> private void updateEsCharge() { - esRunStatus_ChargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()); + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) + { + esRunStatus_ChargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()); + } } /// <summary> /// 鏇存柊鍌ㄨ兘瀹炴椂鏀剧數鐘舵�� /// </summary> private void updateEsDischarge() { - esRunStatus_DischargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()); + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) + { + esRunStatus_DischargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()); + } } - /// <summary> /// 鏇存柊绀句細璐$尞1鏁版嵁UI /// </summary> private void updateSocialContribution1() { socialContribution_Info1_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.coal.ToString()); -#if __IOS__ - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61)) { - socialContribution_Info1_ValuesButton.TextSize = socialContribution_Info1_ValuesButton.TextSize - 4; + socialContribution_Info1_ValuesButton.TextSize = 14; + socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); + socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25); } - +#if __IOS__ + socialContribution_Info1_ValuesButton.Width += Application.GetRealWidth(6); socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4); +#else + socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2); +#endif } /// <summary> /// 鏇存柊绀句細璐�2鐚暟鎹甎I /// </summary> private void updateSocialContribution2() { - socialContribution_Info2_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.co2.ToString()); -#if __IOS__ - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else + socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()); socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif - if (socialContribution_Info2_UintButton.Width > Application.GetRealWidth(61)) + if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61)) { - socialContribution_Info2_UintButton.TextSize = socialContribution_Info2_UintButton.TextSize - 4; + socialContribution_Info2_ValuesButton.TextSize = 14; + socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); } - +#if __IOS__ + socialContribution_Info2_ValuesButton.Width += Application.GetRealWidth(6); socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4); +#else + socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2); +#endif } /// <summary> @@ -1426,18 +1498,20 @@ /// </summary> private void updateSocialContribution3() { - - socialContribution_Info3_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.trees.ToString()); -#if __IOS__ - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else + socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()); socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61)) { - socialContribution_Info3_ValuesButton.TextSize = socialContribution_Info3_ValuesButton.TextSize - 4; + socialContribution_Info3_ValuesButton.TextSize = 14; + socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); + socialContribution_Info3_UintButton.Height = Application.GetRealWidth(25); } +#if __IOS__ + socialContribution_Info3_ValuesButton.Width += Application.GetRealWidth(6); socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4); +#else + socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2); +#endif } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs index 485c9a1..3197659 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs @@ -180,9 +180,10 @@ initContentView(); initBottomView(); initControlEvent(); - Control.Ins.SendReadCommand(function); UpdateStatus(); + + Control.Ins.SendReadCommand(function); } /// <summary> /// 鍔犺浇鍐呭鍖哄煙 @@ -505,177 +506,181 @@ setTempView.AddChidren(setTemp_Temp_MaxValuesTextButton); #endregion - contentView.AddChidren(new Button() + + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null) { - Height = Application.GetRealWidth(12), - }); + contentView.AddChidren(new Button() + { + Height = Application.GetRealWidth(12), + }); - #region flow 鐑按娴侀噺 - var flowView = new FrameLayout() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(343), - Height = Application.GetRealWidth(186), - BackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealHeight(12), - BorderColor = 0x00FFFFFF, - BorderWidth = 0, - }; - contentView.AddChidren(flowView); + #region flow 鐑按娴侀噺 + var flowView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(186), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealHeight(12), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + }; + contentView.AddChidren(flowView); - flow_ValuesButton = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(14), - Width = Application.GetRealWidth(200), - Height = Application.GetRealWidth(25), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 16, - TextColor = CSS_Color.FirstLevelTitleColor, - Text = "鐑按娴侀噺锛�" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min", - IsBold = true, - }; - flowView.AddChidren(flow_ValuesButton); + flow_ValuesButton = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(14), + Width = Application.GetRealWidth(200), + Height = Application.GetRealWidth(25), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 16, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = "鐑按娴侀噺锛�" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min", + IsBold = true, + }; + flowView.AddChidren(flow_ValuesButton); - var flow_HotWaterVolumeTextButton = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(55), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(20), - Text = "鐑按閲�", - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - }; - flowView.AddChidren(flow_HotWaterVolumeTextButton); + var flow_HotWaterVolumeTextButton = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(55), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(20), + Text = "鐑按閲�", + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + flowView.AddChidren(flow_HotWaterVolumeTextButton); - string volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()); - string recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()); - double volume = 0; - double.TryParse(volumeString, out volume); - double recyclVolume = 0; - double.TryParse(recyclVolumeString, out recyclVolume); - int recyclVolumePercent = (int)(recyclVolume / volume * 100); + string volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()); + string recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()); + double volume = 0; + double.TryParse(volumeString, out volume); + double recyclVolume = 0; + double.TryParse(recyclVolumeString, out recyclVolume); + int recyclVolumePercent = (int)(recyclVolume / volume * 100); - flow_VolumeButton = new Button() - { - X = Application.GetRealWidth(343 - 116), - Y = Application.GetRealWidth(55), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(26), - Text = volumeString + "t", - TextAlignment = TextAlignment.CenterRight, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - }; - flowView.AddChidren(flow_VolumeButton); + flow_VolumeButton = new Button() + { + X = Application.GetRealWidth(343 - 116), + Y = Application.GetRealWidth(55), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(26), + Text = volumeString + "t", + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + }; + flowView.AddChidren(flow_VolumeButton); - flow_ValuesBar = new DiyImageSeekBar() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealWidth(79), - Width = Application.GetRealWidth(Application.DesignWidth - 64), - Height = Application.GetRealHeight(8), - SeekBarViewHeight = Application.GetRealHeight(8), - ThumbImageHeight = Application.GetRealHeight(0), - ProgressBarColor = 0xFF42D163, - SeekBarBackgroundColor = 0xFFFFB848, - MaxValue = 100, - Progress = recyclVolumePercent, - SeekBarPadding = Application.GetRealWidth(0), - IsProgressTextShow = false, - ProgressChangeDelayTime = 0, - Enable = false, - IsClickable = false, - }; - flowView.AddChidren(flow_ValuesBar); + flow_ValuesBar = new DiyImageSeekBar() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealWidth(79), + Width = Application.GetRealWidth(Application.DesignWidth - 64), + Height = Application.GetRealHeight(8), + SeekBarViewHeight = Application.GetRealHeight(8), + ThumbImageHeight = Application.GetRealHeight(0), + ProgressBarColor = 0xFF42D163, + SeekBarBackgroundColor = 0xFFFFB848, + MaxValue = 100, + Progress = recyclVolumePercent, + SeekBarPadding = Application.GetRealWidth(0), + IsProgressTextShow = false, + ProgressChangeDelayTime = 0, + Enable = false, + IsClickable = false, + }; + flowView.AddChidren(flow_ValuesBar); - var flow_HeatRecoveryCapacitytTextButton = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(103), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(20), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - TextColor = 0xFF00C22D, - Text = "鐑洖鏀堕噺" - }; - flowView.AddChidren(flow_HeatRecoveryCapacitytTextButton); + var flow_HeatRecoveryCapacitytTextButton = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(103), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(20), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + TextColor = 0xFF00C22D, + Text = "鐑洖鏀堕噺" + }; + flowView.AddChidren(flow_HeatRecoveryCapacitytTextButton); - flow_HeatRecoveryProgressButton = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(125), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(22), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - TextColor = 0xFF00C22D, - Text = recyclVolumePercent + "%" - }; - flowView.AddChidren(flow_HeatRecoveryProgressButton); + flow_HeatRecoveryProgressButton = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(125), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(22), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + TextColor = 0xFF00C22D, + Text = recyclVolumePercent + "%" + }; + flowView.AddChidren(flow_HeatRecoveryProgressButton); - flow_HeatRecoverytValuesButton = new Button() - { - X = Application.GetRealWidth(16), - Y = Application.GetRealWidth(148), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(22), - TextAlignment = TextAlignment.CenterLeft, - TextSize = 14, - TextColor = CSS_Color.FirstLevelTitleColor, - Text = recyclVolume + "t" - }; - flowView.AddChidren(flow_HeatRecoverytValuesButton); + flow_HeatRecoverytValuesButton = new Button() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealWidth(148), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(22), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = recyclVolume + "t" + }; + flowView.AddChidren(flow_HeatRecoverytValuesButton); - var flow_ElectricDriveTextButton = new Button() - { - X = Application.GetRealWidth(343 - 116), - Y = Application.GetRealWidth(103), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(20), - TextAlignment = TextAlignment.CenterRight, - TextSize = 14, - TextColor = 0xFFFC9C04, - Text = "鐢电洿椹遍噺", - }; - flowView.AddChidren(flow_ElectricDriveTextButton); + var flow_ElectricDriveTextButton = new Button() + { + X = Application.GetRealWidth(343 - 116), + Y = Application.GetRealWidth(103), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(20), + TextAlignment = TextAlignment.CenterRight, + TextSize = 14, + TextColor = 0xFFFC9C04, + Text = "鐢电洿椹遍噺", + }; + flowView.AddChidren(flow_ElectricDriveTextButton); - flow_ElectricDriveProgressButton = new Button() - { - X = Application.GetRealWidth(343 - 116), - Y = Application.GetRealWidth(125), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(22), - TextAlignment = TextAlignment.CenterRight, - TextSize = 14, - TextColor = 0xFFFC9C04, - Text = "0%" - }; - if(volume > 0) - { - flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%"; + flow_ElectricDriveProgressButton = new Button() + { + X = Application.GetRealWidth(343 - 116), + Y = Application.GetRealWidth(125), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(22), + TextAlignment = TextAlignment.CenterRight, + TextSize = 14, + TextColor = 0xFFFC9C04, + Text = "0%" + }; + if (volume > 0) + { + flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%"; + } + flowView.AddChidren(flow_ElectricDriveProgressButton); + + flow_ElectricDriveValuesButton = new Button() + { + X = Application.GetRealWidth(343 - 116), + Y = Application.GetRealWidth(148), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(22), + TextAlignment = TextAlignment.CenterRight, + TextSize = 14, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = (volume - recyclVolume) + "t" + }; + flowView.AddChidren(flow_ElectricDriveValuesButton); + + #endregion } - flowView.AddChidren(flow_ElectricDriveProgressButton); - - flow_ElectricDriveValuesButton = new Button() - { - X = Application.GetRealWidth(343 - 116), - Y = Application.GetRealWidth(148), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(22), - TextAlignment = TextAlignment.CenterRight, - TextSize = 14, - TextColor = CSS_Color.FirstLevelTitleColor, - Text = (volume - recyclVolume) + "t" - }; - flowView.AddChidren(flow_ElectricDriveValuesButton); - - #endregion contentView.AddChidren(new Button() { @@ -816,6 +821,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.BottomLeft, }; +#if __IOS__ + socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66); +#endif socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton); var socialContribution_Info2_TipButton = new Button() @@ -882,6 +890,9 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.BottomLeft, }; +#if __IOS__ + socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66); +#endif socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton); var socialContribution_Info3_TipButton = new Button() @@ -988,10 +999,15 @@ #if __IOS__ setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); #else - setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth(); + setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth(); #endif setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal; + +#if __IOS__ + setTemp_UintButton.X = setTemp_ValuesButton.Right - Application.GetRealWidth(4); +#else setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4); +#endif new System.Threading.Thread(() => { var dic = new Dictionary<string, string>(); @@ -1035,16 +1051,22 @@ //鍏嶈垂鐑按 Application.RunOnMainThread(() => { - bodyView.updateFreeMode(); - bodyView.updateTemp(); - bodyView.updateModeUI(); - bodyView.updateSetTemp(); - bodyView.updateFlow(); - bodyView.updateVolume(); - bodyView.updateSocialContribution1(); - bodyView.updateSocialContribution2(); - bodyView.updateSocialContribution3(); - bodyView.updatePowerButton(); + try + { + bodyView.updateFreeMode(); + bodyView.updateTemp(); + bodyView.updateModeUI(); + bodyView.updateSetTemp(); + bodyView.updateFlow(); + bodyView.updateVolume(); + bodyView.updateSocialContribution1(); + bodyView.updateSocialContribution2(); + bodyView.updateSocialContribution3(); + bodyView.updatePowerButton(); + }catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } }); } @@ -1084,8 +1106,11 @@ btnTempValues.TextSize = 28; } btnTempValues.Gravity = Gravity.CenterHorizontal; - +#if __IOS__ + btnTempValuesUint.X = btnTempValues.Right - Application.GetRealWidth(4); +#else btnTempValuesUint.X = btnTempValues.Right ; +#endif } /// <summary> @@ -1137,8 +1162,11 @@ #endif setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal; +#if __IOS__ + setTemp_UintButton.X = setTemp_ValuesButton.Right - Application.GetRealWidth(4); +#else setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4); - +#endif double dd = 35; double.TryParse(function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "0"), out dd); @@ -1151,7 +1179,10 @@ /// </summary> private void updateFlow() { - flow_ValuesButton.Text = "鐑按娴侀噺锛�" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min"; + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null) + { + flow_ValuesButton.Text = "鐑按娴侀噺锛�" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min"; + } } /// <summary> @@ -1159,6 +1190,14 @@ /// </summary> private void updateVolume() { + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.volume.ToString()) == null) + { + return; + } + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()) == null) + { + return; + } volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()); recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()); volume = 0; @@ -1183,23 +1222,16 @@ private void updateSocialContribution1() { socialContribution_Info1_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()); -#if __IOS__ - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61)) { socialContribution_Info1_ValuesButton.TextSize = 14; -#if __IOS__ - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif + socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25); } #if __IOS__ - socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right ; + socialContribution_Info1_ValuesButton.Width += Application.GetRealWidth(6); + socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4); #else socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2); #endif @@ -1210,23 +1242,15 @@ private void updateSocialContribution2() { socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()); -#if __IOS__ - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61)) { socialContribution_Info2_ValuesButton.TextSize = 14; -#if __IOS__ - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif - socialContribution_Info2_UintButton.Y = socialContribution_Info2_UintButton.Y - Application.GetRealWidth(4); + socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); } #if __IOS__ - socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right; + socialContribution_Info2_ValuesButton.Width += Application.GetRealWidth(6); + socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4); #else socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2); #endif @@ -1237,24 +1261,17 @@ /// </summary> private void updateSocialContribution3() { - socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()); -#if __IOS__ - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61)) { socialContribution_Info3_ValuesButton.TextSize = 14; -#if __IOS__ - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif + socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); + //socialContribution_Info3_UintButton.Height = Application.GetRealWidth(23); } #if __IOS__ - socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right; + socialContribution_Info3_ValuesButton.Width += Application.GetRealWidth(6); + socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4); #else socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2); #endif diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs index f09e8d6..9a0583c 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs @@ -197,7 +197,7 @@ infoView1_DateInfo_NextClickButton = new Button() { - X = Application.GetRealWidth(343 - 18 - 6 -32), + X = Application.GetRealWidth(343 - 18 - 6 - 32), Width = Application.GetRealWidth(32 + 6), }; infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextClickButton); @@ -269,206 +269,209 @@ Height = Application.GetRealWidth(16) }); - #region 鐢ㄦ按閲� - infoView2 = new FrameLayout() + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.volume.ToString()) != null) { - Width = Application.GetRealWidth(343), - Height = Application.GetRealWidth(382), - Y = Application.GetRealHeight(16) + infoView1.Bottom, - Gravity = Gravity.CenterHorizontal, - BackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealWidth(12), - BorderColor = 0x00FFFFFF, - BorderWidth = 0, - }; - contentView.AddChidren(infoView2); + #region 鐢ㄦ按閲� - #region 鏃堕棿鏉′欢閫夋嫨 - var infoView2_DateView = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(343 - 34), - Height = Application.GetRealWidth(26), - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealWidth(17), - BackgroundColor = CSS_Color.BackgroundColor, - Radius = (uint)Application.GetRealWidth(13), - BorderColor = 0x00FFFFFF, - BorderWidth = 0, - ScrollEnabled = false, - }; - infoView2.AddChidren(infoView2_DateView); + infoView2 = new FrameLayout() + { + Width = Application.GetRealWidth(343), + Height = Application.GetRealWidth(382), + Y = Application.GetRealHeight(16) + infoView1.Bottom, + Gravity = Gravity.CenterHorizontal, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + }; + contentView.AddChidren(infoView2); - infoView2_Date_Day = new Button() - { - Width = Application.GetRealWidth(103), - Height = Application.GetRealWidth(26), - BackgroundColor = CSS_Color.BackgroundColor, - SelectedBackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealWidth(13), - BorderColor = CSS_Color.BackgroundColor, - BorderWidth = (uint)Application.GetRealWidth(1), - Text = "鏃�", - TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - TextSize = CSS_FontSize.TextFontSize, - IsSelected = true, - }; - infoView2_DateView.AddChidren(infoView2_Date_Day); + #region 鏃堕棿鏉′欢閫夋嫨 + var infoView2_DateView = new HorizontalScrolViewLayout() + { + Width = Application.GetRealWidth(343 - 34), + Height = Application.GetRealWidth(26), + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealWidth(17), + BackgroundColor = CSS_Color.BackgroundColor, + Radius = (uint)Application.GetRealWidth(13), + BorderColor = 0x00FFFFFF, + BorderWidth = 0, + ScrollEnabled = false, + }; + infoView2.AddChidren(infoView2_DateView); + + infoView2_Date_Day = new Button() + { + Width = Application.GetRealWidth(103), + Height = Application.GetRealWidth(26), + BackgroundColor = CSS_Color.BackgroundColor, + SelectedBackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(13), + BorderColor = CSS_Color.BackgroundColor, + BorderWidth = (uint)Application.GetRealWidth(1), + Text = "鏃�", + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + IsSelected = true, + }; + infoView2_DateView.AddChidren(infoView2_Date_Day); - infoView2_Date_Month = new Button() - { - Width = Application.GetRealWidth(103), - Height = Application.GetRealWidth(26), - BackgroundColor = CSS_Color.BackgroundColor, - SelectedBackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealWidth(13), - BorderColor = CSS_Color.BackgroundColor, - BorderWidth = (uint)Application.GetRealWidth(1), - Text = "鏈�", - TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - TextSize = CSS_FontSize.TextFontSize, - IsSelected = false, - }; - infoView2_DateView.AddChidren(infoView2_Date_Month); + infoView2_Date_Month = new Button() + { + Width = Application.GetRealWidth(103), + Height = Application.GetRealWidth(26), + BackgroundColor = CSS_Color.BackgroundColor, + SelectedBackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(13), + BorderColor = CSS_Color.BackgroundColor, + BorderWidth = (uint)Application.GetRealWidth(1), + Text = "鏈�", + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + IsSelected = false, + }; + infoView2_DateView.AddChidren(infoView2_Date_Month); - infoView2_Date_Year = new Button() - { - Width = Application.GetRealWidth(103), - Height = Application.GetRealWidth(26), - BackgroundColor = CSS_Color.BackgroundColor, - SelectedBackgroundColor = CSS_Color.MainBackgroundColor, - Radius = (uint)Application.GetRealWidth(13), - BorderColor = CSS_Color.BackgroundColor, - BorderWidth = (uint)Application.GetRealWidth(1), - Text = "骞�", - TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - TextSize = CSS_FontSize.TextFontSize, - IsSelected = false, - }; - infoView2_DateView.AddChidren(infoView2_Date_Year); + infoView2_Date_Year = new Button() + { + Width = Application.GetRealWidth(103), + Height = Application.GetRealWidth(26), + BackgroundColor = CSS_Color.BackgroundColor, + SelectedBackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(13), + BorderColor = CSS_Color.BackgroundColor, + BorderWidth = (uint)Application.GetRealWidth(1), + Text = "骞�", + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + IsSelected = false, + }; + infoView2_DateView.AddChidren(infoView2_Date_Year); - var infoView2_DateInfoView = new FrameLayout() - { - Y = Application.GetRealWidth(43), - Height = Application.GetRealWidth(55), - }; - infoView2.AddChidren(infoView2_DateInfoView); + var infoView2_DateInfoView = new FrameLayout() + { + Y = Application.GetRealWidth(43), + Height = Application.GetRealWidth(55), + }; + infoView2.AddChidren(infoView2_DateInfoView); - infoView2_DateInfo_PreIconButton = new Button() - { - X = Application.GetRealWidth(18), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(6), - Height = Application.GetRealWidth(10), - UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/PreIcon.png", - }; - infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreIconButton); + infoView2_DateInfo_PreIconButton = new Button() + { + X = Application.GetRealWidth(18), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(6), + Height = Application.GetRealWidth(10), + UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/PreIcon.png", + }; + infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreIconButton); - infoView2_DateInfo_PreClickButton = new Button() - { - Width = Application.GetRealWidth(32 + 6), - }; - infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreClickButton); + infoView2_DateInfo_PreClickButton = new Button() + { + Width = Application.GetRealWidth(32 + 6), + }; + infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreClickButton); - infoView2_DateInfo_DateTextButton = new Button() - { - Gravity = Gravity.Center, - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.Center, - Text = DateTime.Now.ToString("yyyy-MM-dd"), - TextColor = CSS_Color.FirstLevelTitleColor, - IsBold = true, - TextSize = 16, - }; - infoView2_DateInfoView.AddChidren(infoView2_DateInfo_DateTextButton); + infoView2_DateInfo_DateTextButton = new Button() + { + Gravity = Gravity.Center, + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.Center, + Text = DateTime.Now.ToString("yyyy-MM-dd"), + TextColor = CSS_Color.FirstLevelTitleColor, + IsBold = true, + TextSize = 16, + }; + infoView2_DateInfoView.AddChidren(infoView2_DateInfo_DateTextButton); - infoView2_DateInfo_NextIconButton = new Button() - { - X = Application.GetRealWidth(343 - 18 - 6), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(6), - Height = Application.GetRealWidth(10), - UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/NextIcon.png", - }; - infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextIconButton); + infoView2_DateInfo_NextIconButton = new Button() + { + X = Application.GetRealWidth(343 - 18 - 6), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(6), + Height = Application.GetRealWidth(10), + UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/NextIcon.png", + }; + infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextIconButton); - infoView2_DateInfo_NextClickButton = new Button() - { - X = Application.GetRealWidth(343 - 18 - 6 -32), - Width = Application.GetRealWidth(32 + 6), - }; - infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton); + infoView2_DateInfo_NextClickButton = new Button() + { + X = Application.GetRealWidth(343 - 18 - 6 - 32), + Width = Application.GetRealWidth(32 + 6), + }; + infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton); - #endregion + #endregion - #region 鏁版嵁鍥捐〃 - infoView2_EchartsView = new MyEchartsViewOn() - { - Y = Application.GetRealWidth(101), - Height = Application.GetRealWidth(246), - }; - infoView2.AddChidren(infoView2_EchartsView); + #region 鏁版嵁鍥捐〃 + infoView2_EchartsView = new MyEchartsViewOn() + { + Y = Application.GetRealWidth(101), + Height = Application.GetRealWidth(246), + }; + infoView2.AddChidren(infoView2_EchartsView); - echartOption2 = new EchartsOption_Histogram(); - echartOption2.xTitle = "鏃堕棿"; - echartOption2.yTitle = "鐢ㄦ按閲忥紙t锛�"; - //echartOption2.InitXdataText(new List<string>() - //{ - // "21","22","23","24","25","26","26","27","28","29", - // "21","22","23","24","25","26","26","27","28","29", - // "21","22","23","24" - //}); - //echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() { - // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, - // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" }, - // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, - // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" }, - // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" }, - // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" }, - // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" }, - // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, - // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, - // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, - // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" }, - // new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" }, - // new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" }, - // new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" }, - // new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" }, - // new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" }, - // new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" }, - // new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" }, - //}); - //infoView2_EchartsView.ShowWithOption(echartOption2.InitOption()); + echartOption2 = new EchartsOption_Histogram(); + echartOption2.xTitle = "鏃堕棿"; + echartOption2.yTitle = "鐢ㄦ按閲忥紙t锛�"; + //echartOption2.InitXdataText(new List<string>() + //{ + // "21","22","23","24","25","26","26","27","28","29", + // "21","22","23","24","25","26","26","27","28","29", + // "21","22","23","24" + //}); + //echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() { + // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, + // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" }, + // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, + // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" }, + // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" }, + // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" }, + // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" }, + // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, + // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, + // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, + // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" }, + // new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" }, + // new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" }, + // new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" }, + // new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" }, + // new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" }, + // new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" }, + //}); + //infoView2_EchartsView.ShowWithOption(echartOption2.InitOption()); - infoView2.AddChidren(new Button() - { - Height = Application.GetRealWidth(35), - Y = Application.GetRealWidth(340), - Text = "鐢ㄦ按閲�", - TextSize = 14, - TextAlignment = TextAlignment.Center, - TextColor = 0xFFC0C7D4 - }); + infoView2.AddChidren(new Button() + { + Height = Application.GetRealWidth(35), + Y = Application.GetRealWidth(340), + Text = "鐢ㄦ按閲�", + TextSize = 14, + TextAlignment = TextAlignment.Center, + TextColor = 0xFFC0C7D4 + }); - #endregion + #endregion - #endregion - + #endregion + } contentView.AddChidren(new Button() { @@ -514,14 +517,14 @@ tempQueryTimeString = tempQueryTime_Year.ToString() + "/" + tempQueryTime_Month + "/" + tempQueryTime_Day; break; case QueryType.custom_month: - tempQueryTimeString = tempQueryTime_Year.ToString() + "/" + tempQueryTime_Month ; + tempQueryTimeString = tempQueryTime_Year.ToString() + "/" + tempQueryTime_Month; break; case QueryType.custom_year: tempQueryTimeString = tempQueryTime_Year.ToString(); break; } - var revertObj = new HttpServerRequest().GetSensorHistory(tempQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.temp.ToString(),tempQueryTimeString); + var revertObj = new HttpServerRequest().GetSensorHistory(tempQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.temp.ToString(), tempQueryTimeString); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -566,6 +569,10 @@ { return; } + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.volume.ToString()) == null) + { + return; + } var loadPage = new Loading() { LodingBackgroundColor = 0x88888888, @@ -594,7 +601,7 @@ break; } - var revertObj = new HttpServerRequest().GetSensorHistory(waterQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.volume.ToString(),waterQueryTimeString); + var revertObj = new HttpServerRequest().GetSensorHistory(waterQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.volume.ToString(), waterQueryTimeString); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -637,68 +644,72 @@ { SetTempQureyDateDialog(); }; - infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { - var tempQueryDate = new DateTime(tempQueryTime_Year,tempQueryTime_Month,tempQueryTime_Day); + infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => + { + var tempQueryDate = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day); if (tempQueryType == QueryType.day_hour) { - if(tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 1) + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 1) { return; } tempQueryDate = tempQueryDate.AddDays(-1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); } - else if(tempQueryType == QueryType.custom_month) + else if (tempQueryType == QueryType.custom_month) { if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1) { return; } tempQueryDate = tempQueryDate.AddMonths(-1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM"); + tempQueryTime_Day = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM"); } - else if(tempQueryType == QueryType.custom_year) + else if (tempQueryType == QueryType.custom_year) { - if (tempQueryDate.Year == 2023) + if (tempQueryDate.Year <= 2023) { return; } tempQueryDate = tempQueryDate.AddYears(-1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy"); + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy"); } tempQueryTime_Year = tempQueryDate.Year; tempQueryTime_Month = tempQueryDate.Month; tempQueryTime_Day = tempQueryDate.Day; getTempHistory(); }; - infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { + infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => + { var tempQueryDate = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day); if (tempQueryType == QueryType.day_hour) { - if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day) + if (tempQueryDate.Year >= DateTime.Now.Year && tempQueryDate.Month >= DateTime.Now.Month && tempQueryDate.Day >= DateTime.Now.Day) { return; } tempQueryDate = tempQueryDate.AddDays(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); } else if (tempQueryType == QueryType.custom_month) { - if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month ) + if (tempQueryDate.Year >= DateTime.Now.Year && tempQueryDate.Month >= DateTime.Now.Month) { return; } tempQueryDate = tempQueryDate.AddMonths(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM"); + tempQueryTime_Day = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM"); } else if (tempQueryType == QueryType.custom_year) { - if (tempQueryDate.Year == DateTime.Now.Year) + if (tempQueryDate.Year >= DateTime.Now.Year) { return; } tempQueryDate = tempQueryDate.AddYears(1); - infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy"); + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy"); } tempQueryTime_Year = tempQueryDate.Year; tempQueryTime_Month = tempQueryDate.Month; @@ -706,7 +717,8 @@ getTempHistory(); }; - infoView1_Date_Day.MouseUpEventHandler = (sender, e) => { + infoView1_Date_Day.MouseUpEventHandler = (sender, e) => + { if (infoView1_Date_Day.IsSelected) { return; @@ -715,10 +727,17 @@ infoView1_Date_Month.IsSelected = false; infoView1_Date_Year.IsSelected = false; tempQueryType = QueryType.day_hour; + if (DateTime.Now.Date < new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day)) + { + tempQueryTime_Year = DateTime.Now.Year; + tempQueryTime_Month = DateTime.Now.Month; + tempQueryTime_Day = DateTime.Now.Day; + } infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM-dd"); getTempHistory(); }; - infoView1_Date_Month.MouseUpEventHandler = (sender, e) => { + infoView1_Date_Month.MouseUpEventHandler = (sender, e) => + { if (infoView1_Date_Month.IsSelected) { return; @@ -727,10 +746,16 @@ infoView1_Date_Month.IsSelected = true; infoView1_Date_Year.IsSelected = false; tempQueryType = QueryType.custom_month; + if (DateTime.Now.Date < new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day)) + { + tempQueryTime_Year = DateTime.Now.Year; + tempQueryTime_Month = DateTime.Now.Month; + } infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM"); getTempHistory(); }; - infoView1_Date_Year.MouseUpEventHandler = (sender, e) => { + infoView1_Date_Year.MouseUpEventHandler = (sender, e) => + { if (infoView1_Date_Year.IsSelected) { return; @@ -743,115 +768,136 @@ getTempHistory(); }; //-----------鐢ㄦ按 - infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.volume.ToString()) != null) { - SetWaterQureyDateDialog(); - }; - infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { - var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); - if (waterQueryType == QueryType.day_hour) - { - if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) - { - return; - } - waterQueryDate = waterQueryDate.AddDays(-1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); - } - else if (waterQueryType == QueryType.custom_month) - { - if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1) - { - return; - } - waterQueryDate = waterQueryDate.AddMonths(-1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); - } - else if (waterQueryType == QueryType.custom_year) - { - if (waterQueryDate.Year == 2023) - { - return; - } - waterQueryDate = waterQueryDate.AddYears(-1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy"); - } - waterQueryTime_Year = waterQueryDate.Year; - waterQueryTime_Month = waterQueryDate.Month; - waterQueryTime_Day = waterQueryDate.Day; - getWaterHistory(); - }; - infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { - var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); - if (waterQueryType == QueryType.day_hour) - { - if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 2) - { - return; - } - waterQueryDate = waterQueryDate.AddDays(1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); - } - else if (waterQueryType == QueryType.custom_month) - { - if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month) - { - return; - } - waterQueryDate = waterQueryDate.AddMonths(1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); - } - else if (waterQueryType == QueryType.custom_year) - { - if (waterQueryDate.Year == 2023) - { - return; - } - waterQueryDate = waterQueryDate.AddYears(1); - infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy"); - } - waterQueryTime_Year = waterQueryDate.Year; - waterQueryTime_Month = waterQueryDate.Month; - waterQueryTime_Day = waterQueryDate.Day; - getWaterHistory(); - }; - infoView2_Date_Day.MouseDownEventHandler = (sender, e) => { - if (infoView2_Date_Day.IsSelected) - { - return; - } - infoView2_Date_Day.IsSelected = true; - infoView2_Date_Month.IsSelected = false; - infoView2_Date_Year.IsSelected = false; - waterQueryType = QueryType.day_hour; - infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM-dd"); - getWaterHistory(); - }; - infoView2_Date_Month.MouseDownEventHandler = (sender, e) => { - if (infoView2_Date_Month.IsSelected) - { - return; - } - infoView2_Date_Day.IsSelected = false; - infoView2_Date_Month.IsSelected = true; - infoView2_Date_Year.IsSelected = false; - waterQueryType = QueryType.custom_month; - infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM"); - getWaterHistory(); - }; - infoView2_Date_Year.MouseDownEventHandler = (sender, e) => { - if (infoView2_Date_Year.IsSelected) - { - return; - } - infoView2_Date_Day.IsSelected = false; - infoView2_Date_Month.IsSelected = false; - infoView2_Date_Year.IsSelected = true; - waterQueryType = QueryType.custom_year; - infoView2_DateInfo_DateTextButton.Text = waterQueryTime_Year.ToString(); - getWaterHistory(); - }; + infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + { + SetWaterQureyDateDialog(); + }; + infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => + { + var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); + if (waterQueryType == QueryType.day_hour) + { + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) + { + return; + } + waterQueryDate = waterQueryDate.AddDays(-1); + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + } + else if (waterQueryType == QueryType.custom_month) + { + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1) + { + return; + } + waterQueryDate = waterQueryDate.AddMonths(-1); + waterQueryTime_Day = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); + } + else if (waterQueryType == QueryType.custom_year) + { + if (waterQueryDate.Year <= 2023) + { + return; + } + waterQueryDate = waterQueryDate.AddYears(-1); + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy"); + } + waterQueryTime_Year = waterQueryDate.Year; + waterQueryTime_Month = waterQueryDate.Month; + waterQueryTime_Day = waterQueryDate.Day; + getWaterHistory(); + }; + infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => + { + var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); + if (waterQueryType == QueryType.day_hour) + { + if (waterQueryDate.Year >= DateTime.Now.Year && waterQueryDate.Month >= DateTime.Now.Month && waterQueryDate.Day >= DateTime.Now.Day) + { + return; + } + waterQueryDate = waterQueryDate.AddDays(1); + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + } + else if (waterQueryType == QueryType.custom_month) + { + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month) + { + return; + } + waterQueryDate = waterQueryDate.AddMonths(1); + waterQueryTime_Day = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM"); + } + else if (waterQueryType == QueryType.custom_year) + { + if (waterQueryDate.Year >= DateTime.Now.Year) + { + return; + } + waterQueryDate = waterQueryDate.AddYears(1); + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy"); + } + waterQueryTime_Year = waterQueryDate.Year; + waterQueryTime_Month = waterQueryDate.Month; + waterQueryTime_Day = waterQueryDate.Day; + getWaterHistory(); + }; + infoView2_Date_Day.MouseDownEventHandler = (sender, e) => + { + if (infoView2_Date_Day.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = true; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = false; + waterQueryType = QueryType.day_hour; + if (DateTime.Now.Date < new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day)) + { + waterQueryTime_Year = DateTime.Now.Year; + waterQueryTime_Month = DateTime.Now.Month; + waterQueryTime_Day = DateTime.Now.Day; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_Date_Month.MouseDownEventHandler = (sender, e) => + { + if (infoView2_Date_Month.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = true; + infoView2_Date_Year.IsSelected = false; + waterQueryType = QueryType.custom_month; + if (DateTime.Now.Date < new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day)) + { + waterQueryTime_Year = DateTime.Now.Year; + waterQueryTime_Month = DateTime.Now.Month; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM"); + getWaterHistory(); + }; + infoView2_Date_Year.MouseDownEventHandler = (sender, e) => + { + if (infoView2_Date_Year.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = true; + waterQueryType = QueryType.custom_year; + infoView2_DateInfo_DateTextButton.Text = waterQueryTime_Year.ToString(); + getWaterHistory(); + }; + } } /// <summary> @@ -872,7 +918,7 @@ pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); } - if(tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) + if (tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) { pickerItems_Month = new List<string>(); if (tempQueryTime_Year == DateTime.Now.Year) @@ -967,6 +1013,19 @@ }; topView.AddChidren(btnConfrim); + var btnToday = new Button() + { + X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + Visible = false, + Enable = false, + Text= "浠婃棩", + }; + topView.AddChidren(btnToday); + UIPickerView uIPickerView = new UIPickerView() { Y = Application.GetRealHeight(40), @@ -976,8 +1035,8 @@ optionBaseView.AddChidren(uIPickerView); uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(tempQueryTime_Year.ToString()), - pickerItems_Month == null ? 0: pickerItems_Month.IndexOf(tempQueryTime_Month.ToString()), - pickerItems_Day == null? 0: pickerItems_Day.IndexOf(tempQueryTime_Day.ToString())); + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(tempQueryTime_Month.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(tempQueryTime_Day.ToString())); dialog.Show(); @@ -992,6 +1051,10 @@ }; uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { + if (int1 < 0) + { + int1 = 1; + } if (pickerItems_Year[int1] != item1.ToString()) { int.TryParse(pickerItems_Year[int1], out item1); @@ -1043,7 +1106,7 @@ } if (pickerItems_Month != null) { - if (int2 > pickerItems_Month.Count) + if (int2 >= pickerItems_Month.Count || int2 < 0) { int2 = 0; } @@ -1070,16 +1133,21 @@ } } } - - uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); - uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), - pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), - pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + try + { + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + }catch(Exception ex) + { + MainPage.Log("Error", $"閲戣寕鍘嗗彶鏁版嵁鎺т欢寮傚父:{ex.Message}"); + } } } if (pickerItems_Day != null) { - if (int3 >= pickerItems_Day.Count) + if (int3 >= pickerItems_Day.Count || int3 < 0) { int3 = 0; } @@ -1100,7 +1168,7 @@ { tempQueryTime_Month = item2; } - infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM"); + infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, 1).ToString("yyyy-MM"); if (tempQueryType == QueryType.day_hour) { if (item3 != tempQueryTime_Day) @@ -1113,6 +1181,73 @@ getTempHistory(); }; + + if (tempQueryType == QueryType.day_hour) + { + try + { + btnToday.Visible = btnToday.Enable = true; + btnToday.MouseUpEventHandler = (sender, e) => + { + pickerItems_Year = new List<string>(); + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (tempQueryTime_Year == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (tempQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (tempQueryTime_Month == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(tempQueryTime_Year, tempQueryTime_Month); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + item3 = tempQueryTime_Day = DateTime.Now.Day; + item2 = tempQueryTime_Month = DateTime.Now.Month; + item1 = tempQueryTime_Year = DateTime.Now.Year; + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(tempQueryTime_Year.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(tempQueryTime_Month.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(tempQueryTime_Day.ToString())); + }; + } + catch { } + } } public void SetWaterQureyDateDialog() @@ -1251,6 +1386,10 @@ }; uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => { + if (int1 < 0) + { + int1 = 0; + } if (pickerItems_Year[int1] != item1.ToString()) { int.TryParse(pickerItems_Year[int1], out item1); @@ -1302,7 +1441,7 @@ } if (pickerItems_Month != null) { - if (int2 > pickerItems_Month.Count) + if (int2 > pickerItems_Month.Count || int2 < 0) { int2 = 0; } @@ -1338,7 +1477,7 @@ } if (pickerItems_Day != null) { - if (int3 >= pickerItems_Day.Count) + if (int3 >= pickerItems_Day.Count || int3 < 0) { int3 = 0; } @@ -1359,7 +1498,7 @@ { waterQueryTime_Month = item2; } - infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM"); + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, 1).ToString("yyyy-MM"); if (waterQueryType == QueryType.day_hour) { if (item3 != waterQueryTime_Day) @@ -1371,6 +1510,87 @@ } getWaterHistory(); }; + + var btnToday = new Button() + { + X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + Visible = false, + Enable = false, + Text = "浠婃棩", + }; + topView.AddChidren(btnToday); + + + if (waterQueryType == QueryType.day_hour) + { + try + { + btnToday.Visible = btnToday.Enable = true; + btnToday.MouseUpEventHandler = (sender, e) => + { + pickerItems_Year = new List<string>(); + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (waterQueryType == QueryType.custom_month || waterQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (waterQueryTime_Year == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (waterQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (waterQueryTime_Month == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(waterQueryTime_Year, waterQueryTime_Month); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + item3 = waterQueryTime_Day = DateTime.Now.Day; + item2 = waterQueryTime_Month = DateTime.Now.Month; + item1 = waterQueryTime_Year = DateTime.Now.Year; + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(waterQueryTime_Year.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(waterQueryTime_Month.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(waterQueryTime_Day.ToString())); + }; + } + catch { } + } } @@ -1406,5 +1626,4 @@ /// </summary> custom_year, } -} - +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs index f0b6aeb..e64d59a 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs @@ -74,6 +74,14 @@ #if __ANDROID__ public string optionString = @"{ + tooltip: { + trigger: 'axis', + axisPointer: { + crossStyle: { + color: '#999' + } + } + }, grid: { top: '10%', left: '15%', @@ -140,6 +148,14 @@ #else public string optionString = @"{ + tooltip: { + trigger: 'axis', + axisPointer: { + crossStyle: { + color: '#999' + } + } + }, grid: { top: '10%', left: '10%', diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs index 1a66ef0..8a086c3 100644 --- a/SiriIntents/Server/HttpUtil.cs +++ b/SiriIntents/Server/HttpUtil.cs @@ -16,13 +16,13 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - const string APP_KEY = "HDL-HOME-APP"; - const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + //const string APP_KEY = "HDL-HOME-APP"; + //const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; - //public const string APP_KEY = "HDL-HOME-APP-TEST"; - //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; + public const string APP_KEY = "HDL-HOME-APP-TEST"; + public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm //const string APP_KEY = "CPEVRLRT"; -- Gitblit v1.8.0