From c00da77d00a479fa5d022346a6d9075f90a5c087 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期六, 14 九月 2024 10:05:34 +0800 Subject: [PATCH] 退出登录时间调整,新风,音乐 --- HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs | 899 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 641 insertions(+), 258 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs index 8423a14..02bbf02 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs @@ -1,4 +1,7 @@ 锘縰sing System; +using System.Collections.Generic; +using HDL_ON.DAL.Server; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -7,7 +10,7 @@ { public class InverterJinmaoPage : FrameLayout { - FrameLayout bodyView; + static InverterJinmaoPage bodyView; Function function; /// <summary> /// 浠婃棩鍙戠數閲忔暟鎹寜閽� @@ -26,6 +29,10 @@ /// </summary> Button pvLoad_TodayValuesButton; /// <summary> + /// 浠婃棩鐢ㄧ數閲忓崟浣嶆寜閽� + /// </summary> + Button loadEle_TodayUintButton; + /// <summary> /// 绱鐢ㄧ數閲忔暟鎹寜閽� /// </summary> Button pvLoad_TotalValuesButton; @@ -36,7 +43,7 @@ /// <summary> /// 鍏変紡杩愯鐘舵�佸浘鏍囨寜閽� /// </summary> - Button pvRunStatus_IconButtonp; + Button pvRunStatus_IconButton; /// <summary> /// 鍏変紡杩愯鐘舵�佹枃鏈寜閽� /// </summary> @@ -54,9 +61,64 @@ /// </summary> Button pvGeneration_MonthValuesButton; /// <summary> - /// 鍏変紡鏈勾鍙戠數閲忔暟鎹寜閽� + /// 鍏変紡瀹炴椂鐢ㄧ數鍔熺巼鏁版嵁鎸夐挳 /// </summary> - Button pvGeneration_YearValuesButton; + Button loadElec_ValuesButton; + /// <summary> + /// 鍏変紡鐘舵�佷粖鏃ョ敤鐢甸噺鏁版嵁鎸夐挳 + /// </summary> + Button powerUsage_TodayValuesButton; + /// <summary> + /// 鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺鏁版嵁鎸夐挳 + /// </summary> + Button loadElec_MonthValuesButton; + /// <summary> + /// 鍌ㄨ兘杩愯鐘舵�佷俊鎭尯鍩� + /// </summary> + FrameLayout esStatus_InfoView; + /// <summary> + /// 鍌ㄨ兘杩愯鐘舵�佸浘鏍囨寜閽� + /// </summary> + Button esRunStatus_Info_IconButton; + /// <summary> + /// 鍌ㄨ兘杩愯鐘舵�佹枃鏈寜閽� + /// </summary> + Button esRunStatus_Info_TextButton; + /// <summary> + /// 鍌ㄨ兘鐢垫睜鐘舵�佸浘鏍囨寜閽� + /// </summary> + Button esRunStatus_BatteryIconButton; + /// <summary> + /// 鍌ㄨ兘鐢垫睜鐘舵�佺櫨鍒嗘瘮鎸夐挳 + /// </summary> + Button esRunStatus_BatteryValuesButton; + /// <summary> + /// 鍌ㄨ兘瀹炴椂鍏呯數鍔熺巼 + /// </summary> + Button esRunStatus_ChargeValuesButton; + /// <summary> + /// 鍌ㄨ兘瀹炴椂鏀剧數鍔熺巼 + /// </summary> + Button esRunStatus_DischargeValuesButton; + + /// <summary> + /// </summary> + Button socialContribution_Info1_ValuesButton; + /// <summary> + /// </summary> + Button socialContribution_Info1_UintButton; + /// <summary> + /// </summary> + Button socialContribution_Info2_ValuesButton; + /// <summary> + /// </summary> + Button socialContribution_Info2_UintButton; + /// <summary> + /// </summary> + Button socialContribution_Info3_UintButton; + /// <summary> + /// </summary> + Button socialContribution_Info3_ValuesButton; public InverterJinmaoPage() @@ -148,18 +210,19 @@ pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8); #else pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft; - pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth(); + pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37); + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4); #endif pvGenerate_todayUintButton = new Button() { - Y = Application.GetRealWidth(45), + 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() @@ -213,11 +276,11 @@ loadEleView.AddChidren(loadEle_TodayTextButton); - var loadEle_TodayUintButton = new Button() + loadEle_TodayUintButton = new Button() { - Y = Application.GetRealWidth(45), + Y = Application.GetRealWidth(43), Height = Application.GetRealWidth(17), - Text = "kw", + Text = "kwh", TextColor = CSS_Color.MainBackgroundColor, TextSize = 12, TextAlignment = TextAlignment.CenterRight, @@ -242,6 +305,13 @@ TextAlignment = TextAlignment.TopRight, IsBold = true, }; +#if __IOS__ + pvLoad_TodayValuesButton.Y = Application.GetRealWidth(34); + pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 12) - loadEle_TodayUintButton.Width; +#else + pvLoad_TodayValuesButton.Y = Application.GetRealWidth(37); + pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 16) - loadEle_TodayUintButton.Width; +#endif loadEleView.AddChidren(pvLoad_TodayValuesButton); pvLoad_TotalValuesButton = new Button() @@ -313,7 +383,7 @@ }; pvEleGenerationInfoView.AddChidren(pvRunStatusInfoView); - pvRunStatus_IconButtonp = new Button() + pvRunStatus_IconButton = new Button() { X = Application.GetRealWidth(8 + 14), Gravity = Gravity.CenterVertical, @@ -321,7 +391,7 @@ Height = Application.GetRealWidth(12), UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png", }; - pvRunStatusInfoView.AddChidren(pvRunStatus_IconButtonp); + pvRunStatusInfoView.AddChidren(pvRunStatus_IconButton); pvRunStatus_TextButton = new Button() { @@ -339,9 +409,45 @@ Y = Application.GetRealWidth(20), Width = Application.GetRealWidth(151), Height = Application.GetRealWidth(151), - BackgroundImagePath = "FunctionIcon/Acst/Inverter/PvBgRun.png" }; pvEleGenerationInfoView.AddChidren(powerGenerationView); + + var powerGenerationBg = new Button() + { + UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgRun.png" + }; + powerGenerationView.AddChidren(powerGenerationBg); + + new System.Threading.Thread(() => + { + try + { + int index = 1; + float pvPower = 0.00f; + while (index < 361) + { + float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()), out pvPower); + if (pvPower > 0.00f) + { + Application.RunOnMainThread(() => + { + powerGenerationBg.SetRotation(1f * index++); + }); + System.Threading.Thread.Sleep(50); + if (index == 361) + { + index = 1; + } + } + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕UI鎺т欢鏃嬭浆寮傚父:{ex.Message}"); + } + }) + { IsBackground = true }.Start(); + #endregion #region 鍏変紡鍙戠數閲� @@ -366,7 +472,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, @@ -395,7 +501,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, @@ -424,7 +530,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, @@ -433,13 +539,13 @@ #endregion #region 鍏変紡鏈勾鍙戠數閲� - pvGeneration_YearValuesButton = new Button() + var pvGeneration_YearValuesButton = new Button() { X = Application.GetRealWidth(16 + 212), Y = Application.GetRealWidth(191), Width = Application.GetRealWidth(100), Height = Application.GetRealWidth(24), - Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()), + Text = "---", TextAlignment = TextAlignment.Center, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = 18, @@ -453,13 +559,57 @@ 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, }; pvEleGenerationInfoView.AddChidren(powerGeneration_YearTextButton); + new System.Threading.Thread(() => + { + try + { + var revertObj = new HttpServerRequest().GetSensorHistory("custom_year", + function.deviceId, InverterJinmao_AttrEnum.pv_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(() => + { + pvGeneration_YearValuesButton.Text = totalValues.ToString(); + while (true) + { + if (pvGeneration_YearValuesButton.Width < pvGeneration_YearValuesButton.GetTextWidth()) + { + pvGeneration_YearValuesButton.TextSize--; + } + else + { + break; + } + } + }); + } + } + } + catch (Exception ex) + { + MainPage.Log("Error", "璇诲彇閲戣寕鏈勾鍙戠數閲忔暟鎹紓甯革細" + ex.Message); + } + }) + { IsBackground = true }.Start(); + #endregion + #endregion contentView.AddChidren(new Button() @@ -486,11 +636,46 @@ Y = Application.GetRealWidth(20), Width = Application.GetRealWidth(151), Height = Application.GetRealWidth(151), - BackgroundImagePath = "FunctionIcon/Acst/Inverter/PvBgDischarge.png" }; electricityUsageStatusView.AddChidren(powerUsageView); - var powerUsage_ValuesButton = new Button() + var powerUsageBg = new Button() + { + UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgDischarge.png" + }; + powerUsageView.AddChidren(powerUsageBg); + + new System.Threading.Thread(() => + { + try + { + int index = 1; + float loadPower = 0.00f; + while (index < 361) + { + float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()), out loadPower); + if (loadPower > 0.00f) + { + Application.RunOnMainThread(() => + { + powerUsageBg.SetRotation(1f * index++); + }); + System.Threading.Thread.Sleep(50); + if (index == 361) + { + index = 1; + } + } + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕UI鎺т欢鏃嬭浆寮傚父2:{ex.Message}"); + } + }) + { IsBackground = true }.Start(); + + loadElec_ValuesButton = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealWidth(46), @@ -502,7 +687,7 @@ TextSize = 24, IsBold = true, }; - powerUsageView.AddChidren(powerUsage_ValuesButton); + powerUsageView.AddChidren(loadElec_ValuesButton); var powerUsage_TextButton = new Button() { @@ -510,7 +695,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, @@ -518,7 +703,7 @@ powerUsageView.AddChidren(powerUsage_TextButton); - var powerUsage_TodayValuesButton = new Button() + powerUsage_TodayValuesButton = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(191), @@ -532,21 +717,20 @@ }; electricityUsageStatusView.AddChidren(powerUsage_TodayValuesButton); - var powerUsage_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, }; - electricityUsageStatusView.AddChidren(powerUsage_TodayTextButton); + electricityUsageStatusView.AddChidren(loadElec_TodayTextButton); - - var powerUsage_MonthValuesButton = new Button() + loadElec_MonthValuesButton = new Button() { X = Application.GetRealWidth(16 + 105), Y = Application.GetRealWidth(191), @@ -558,7 +742,7 @@ TextSize = 18, IsBold = true, }; - electricityUsageStatusView.AddChidren(powerUsage_MonthValuesButton); + electricityUsageStatusView.AddChidren(loadElec_MonthValuesButton); var powerUsage_MonthTextButton = new Button() { @@ -566,7 +750,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, @@ -594,191 +778,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); - var 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); - var 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); - var 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); - var 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, - }; -#if __IOS__ - esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth(); -#endif - 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); - var 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", - }; - 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(17), - 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); - var 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+15), - 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); - var 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() { @@ -826,7 +1055,7 @@ }; socialContribution_InfoView_1.AddChidren(socialContribution_Info1_IconButton); - var socialContribution_Info1_ValuesButton = new Button() + socialContribution_Info1_ValuesButton = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealWidth(68), @@ -838,14 +1067,10 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton); - var socialContribution_Info1_UintButton = new Button() + socialContribution_Info1_UintButton = new Button() { X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4), Y = Application.GetRealWidth(68), @@ -856,6 +1081,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() @@ -896,7 +1124,7 @@ }; socialContribution_InfoView_2.AddChidren(socialContribution_Info2_IconButton); - var socialContribution_Info2_ValuesButton = new Button() + socialContribution_Info2_ValuesButton = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealWidth(68), @@ -908,14 +1136,10 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton); - var socialContribution_Info2_UintButton = new Button() + socialContribution_Info2_UintButton = new Button() { X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4), Y = Application.GetRealWidth(68), @@ -926,6 +1150,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() @@ -966,7 +1193,7 @@ }; socialContribution_InfoView_3.AddChidren(socialContribution_Info3_IconButton); - var socialContribution_Info3_ValuesButton = new Button() + socialContribution_Info3_ValuesButton = new Button() { X = Application.GetRealWidth(12), Y = Application.GetRealWidth(68), @@ -978,14 +1205,10 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton); - var socialContribution_Info3_UintButton = new Button() + socialContribution_Info3_UintButton = new Button() { X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4), Y = Application.GetRealWidth(68), @@ -996,6 +1219,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() @@ -1016,13 +1242,13 @@ #endregion - + Control.Ins.SendReadCommand(function); } /// <summary> /// 鏇存柊鐣岄潰鏁版嵁 /// </summary> /// <param name="temp"></param> - public void UpdateStatus(Function temp) + public static void UpdateStatus(Function temp) { if (bodyView == null) { @@ -1030,45 +1256,41 @@ } Application.RunOnMainThread(() => { - /// 鏇存柊浠婃棩鍙戠數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString())) + try { - upatePvGenerateTodayValues(); + /// 鏇存柊浠婃棩鍙戠數閲� + bodyView.upatePvGenerateTodayValues(); + /// 鏇存柊绱鍙戠數閲� + bodyView.upatePvGenerateTotalValues(); + /// 鏇存柊浠婃棩鐢ㄧ數閲� + bodyView.upatePvLoadTodayValues(); + /// 鏇存柊绱鐢ㄧ數閲� + bodyView.upatePvLoadTotalValues(); + /// 鏇存柊鍏変紡杩愯鐘舵�� + bodyView.upatePvRunStatus(); + /// 鏇存柊鍏変紡鍙戠數鍔熺巼 + bodyView.updatePvPower(); + /// 鏇存柊鍏変紡鏈湀鍙戠數閲� + bodyView.upatePvGenerateMonthValues(); + /// 鏇存柊鍏変紡鐢ㄧ數鍔熺巼 + bodyView.updateLoadElec(); + ///鏇存柊鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺 + bodyView.updateLoadElecMonthValues(); + //鏇存柊鍌ㄨ兘杩愯鐘舵�� + bodyView.updateEsRunStates(); + //鏇存柊鍌ㄨ兘鐢垫睜鐧惧垎姣� + bodyView.updateEsBatterySoc(); + //鏇存柊鍌ㄨ兘瀹炴椂鍏呯數鐘舵�� + bodyView.updateEsCharge(); + //鏇存柊鍌ㄨ兘瀹炴椂鏀剧數鐘舵�� + bodyView.updateEsDischarge(); + bodyView.updateSocialContribution1(); + bodyView.updateSocialContribution2(); + bodyView.updateSocialContribution3(); } - /// 鏇存柊绱鍙戠數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString())) + catch (Exception ex) { - upatePvGenerateTotalValues(); - } - /// 鏇存柊浠婃棩鐢ㄧ數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString())) - { - upatePvLoadTodayValues(); - } - /// 鏇存柊绱鐢ㄧ數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString())) - { - upatePvLoadTotalValues(); - } - /// 鏇存柊鍏変紡杩愯鐘舵�� - if (function.GetAttrState(InverterJinmao_AttrEnum.system_status.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.system_status.ToString())) - { - upatePvRunStatus(); - } - /// 鏇存柊鍏変紡鍙戠數鍔熻兘 - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString())) - { - upatePvPower(); - } - /// 鏇存柊鍏変紡鏈湀鍙戠數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString())) - { - upatePvGenerateMonthValues(); - } - /// 鏇存柊鍏変紡鏈勾鍙戠數閲� - if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString())) - { - upatePvGenerateYearValues(); + MainPage.Log("Error", $"閲戣寕鍏変紡鏇存柊寮傚父:{ex.StackTrace}"); } }); } @@ -1079,6 +1301,15 @@ private void upatePvGenerateTodayValues() { pvGenerate_TodayValuesButton.Text = pvGeneration_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()); + +#if __IOS__ + pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft; + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8); +#else + pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft; + pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37); + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4); +#endif pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right; } /// <summary> @@ -1089,25 +1320,33 @@ pvGeneration_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString()); } /// <summary> - /// 鏇存柊鍏変紡鏈勾鍙戠數閲� - /// </summary> - private void upatePvGenerateYearValues() - { - pvGeneration_YearValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()); - } - /// <summary> /// 鏇存柊绱鍙戠數閲� /// </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 = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()); + pvLoad_TodayValuesButton.Text = powerUsage_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()); + +#if __IOS__ + pvLoad_TodayValuesButton.Y = Application.GetRealWidth(34); + pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 12) - loadEle_TodayUintButton.Width; +#else + pvLoad_TodayValuesButton.Y = Application.GetRealWidth(37); + pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 16) - loadEle_TodayUintButton.Width; +#endif + } + /// <summary> + /// 鏇存柊鏈湀鐢ㄧ數閲� + /// </summary> + private void updateLoadElecMonthValues() + { + loadElec_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_month.ToString()); } /// <summary> /// 鏇存柊绱鐢ㄧ數閲� @@ -1126,19 +1365,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; @@ -1148,11 +1387,155 @@ /// <summary> /// 鏇存柊鍏変紡鍙戠數鍔熺巼 /// </summary> - private void upatePvPower() + private void updatePvPower() { pvPower_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()); } + /// <summary> + /// 鏇存柊鍏変紡鐢ㄧ數鍔熺巼 + /// </summary> + private void updateLoadElec() + { + loadElec_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()); + } + /// <summary> + /// 鏇存柊鍌ㄨ兘杩愯鐘舵�� + /// </summary> + private void updateEsRunStates() + { + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) + { + 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> + /// 鏇存柊鍌ㄨ兘鐢垫睜鐧惧垎姣旂姸鎬� + /// </summary> + private void updateEsBatterySoc() + { + if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null) + { + esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%"; + if (esRunStatus_BatteryIconButton.Text == "100%") + { + esRunStatus_BatteryIconButton.IsSelected = true; + } + } + } + /// <summary> + /// 鏇存柊鍌ㄨ兘瀹炴椂鍏呯數鐘舵�� + /// </summary> + private void updateEsCharge() + { + 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() + { + 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()); + socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); + if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61)) + { + 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(WaterHeaterJinmao_AttrEnum.co2.ToString()); + socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); + if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61)) + { + 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> + /// 鏇存柊绀句細璐�3鐚暟鎹甎I + /// </summary> + private void updateSocialContribution3() + { + socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()); + socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); + if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61)) + { + 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 + } } } -- Gitblit v1.8.0