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/WaterHeaterJinmaoPage.cs | 1404 +++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 994 insertions(+), 410 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs index 26256e4..fe07f72 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using com.hdl.on; using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -9,15 +10,144 @@ { public class WaterHeaterJinmaoPage : FrameLayout { - FrameLayout bodyView; + static WaterHeaterJinmaoPage bodyView; VerticalScrolViewLayout contentView; FrameLayout bottomView; Function function; + + + /// <summary> + /// 鐑按妯″紡鐘舵�佸尯鍩� + /// </summary> + FrameLayout modeFreeView; + /// <summary> + /// 鐑按妯″紡鐘舵�佸浘鏍� + /// </summary> + Button modeFree_IconButton; + /// <summary> + /// 鐑按妯″紡鐘舵�佹枃鏈� + /// </summary> + Button modeFree_TextButton; + /// <summary> + /// 鐑按娓╁害鍊� + /// </summary> + Button btnTempValues; + /// <summary> + /// 鐑按娓╁害鍗曚綅 + /// </summary> + Button btnTempValuesUint; + /// <summary> + /// 鑺傝兘妯″紡鎺у埗鎸夐挳 + /// </summary> + Button btnControlModeEconomic; + /// <summary> + /// 鑺傝兘妯″紡鎺у埗鍖哄煙 + /// </summary> + FrameLayout mode_EconomicView; + /// <summary> + /// 鑺傝兘妯″紡鍥炬爣鎸夐挳 + /// </summary> + Button mode_Economic_IconButton; + /// <summary> + /// 鑺傝兘妯″紡鏂囨湰鎸夐挳 + /// </summary> + Button mode_Economic_TextButton; + /// <summary> + /// 閫熺儹妯″紡鎺у埗鎸夐挳 + /// </summary> + Button btnControlModeQuickHeat; + /// <summary> + /// 閫熺儹妯″紡鎺у埗鍖哄煙 + /// </summary> + FrameLayout mode_QuickHeatView; + /// <summary> + /// 閫熺儹妯″紡鍥炬爣鎸夐挳 + /// </summary> + Button mode_QuickHeat_IconButton; + /// <summary> + /// 閫熺儹妯″紡鏂囨湰鎸夐挳 + /// </summary> + Button mode_QuickHeat_TextButton; + /// <summary> + /// 璁剧疆娓╁害鏂囨湰鎸夐挳 + /// </summary> + Button setTemp_ValuesButton; + /// <summary> + /// 璁剧疆娓╁害鍗曚綅鎸夐挳 + /// </summary> + Button setTemp_UintButton; + /// <summary> + /// 璁剧疆娓╁害鎺у埗鎺т欢 + /// </summary> + DiyImageSeekBar setTemp_Bar; + /// <summary> + /// 鐑按娴侀噺鏁版嵁鎸夐挳 + /// </summary> + Button flow_ValuesButton; + /// <summary> + /// 鐑按鎬绘祦閲忔暟鎹寜閽� + /// </summary> + Button flow_VolumeButton; + /// <summary> + /// 鐑按娴侀噺姣旀帶浠� + /// </summary> + DiyImageSeekBar flow_ValuesBar; + /// <summary> + /// 鐑洖鏀剁櫨鍒嗘瘮鏁版嵁鎸夐挳 + /// </summary> + Button flow_HeatRecoveryProgressButton; + /// <summary> + /// 鐑洖鏀舵暟鎹寜閽� + /// </summary> + Button flow_HeatRecoverytValuesButton; + /// <summary> + /// 鐢电洿椹辩櫨鍒嗘瘮鏁版嵁鎸夐挳 + /// </summary> + Button flow_ElectricDriveProgressButton; + /// <summary> + /// 鐢电洿椹辨暟鎹寜閽� + /// </summary> + Button flow_ElectricDriveValuesButton; + string volumeString = string.Empty; + string recyclVolumeString = string.Empty; + double volume = 0.00; + double recyclVolume = 0.00; + int recyclVolumePercent = 0; + + /// <summary> + /// 鐑洖鏀惰妭鐢甸噺鏁版嵁鎸夐挳 + /// </summary> + Button socialContribution_Info1_ValuesButton; + /// <summary> + /// 鐑洖鏀惰妭鐢甸噺鍗曚綅鎸夐挳 + /// </summary> + Button socialContribution_Info1_UintButton; + /// <summary> + /// CO2鍑忔帓閲忔暟鎹寜閽� + /// </summary> + Button socialContribution_Info2_ValuesButton; + /// <summary> + /// CO2鍑忔帓閲忓崟浣嶆寜閽� + /// </summary> + Button socialContribution_Info2_UintButton; + /// <summary> + /// 绛夋晥妞嶆爲閲忔暟鎹寜閽� + /// </summary> + Button socialContribution_Info3_UintButton; + /// <summary> + /// 绛夋晥妞嶆爲閲忓崟浣嶆寜閽� + /// </summary> + Button socialContribution_Info3_ValuesButton; + /// <summary> + /// 寮�鍏虫寜閽� + /// </summary> + Button btnPowerControl; public WaterHeaterJinmaoPage(Function deviceFunction) { bodyView = this; function = deviceFunction; + this.BackgroundColor = CSS_Color.BackgroundColor; } public void LoadPage(Action action) @@ -25,7 +155,6 @@ var topView = new TopViewDiv(bodyView, function.name); topView.LoadTopView_FunctionTop(function, action); - contentView = new VerticalScrolViewLayout() { @@ -47,6 +176,10 @@ initContentView(); initBottomView(); + initControlEvent(); + + UpdateStatus(); + Control.Ins.SendReadCommand(function); } /// <summary> @@ -57,7 +190,7 @@ contentView.AddChidren(new Button() { Height = Application.GetRealHeight(16) }); #region 鐑按鍣ㄧ姸鎬� - var infoView = new FrameLayout() + FrameLayout infoView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), @@ -69,20 +202,20 @@ }; contentView.AddChidren(infoView); - var infoView_ModeFreeView = new FrameLayout() + modeFreeView = new FrameLayout() { X = 0 - Application.GetRealWidth(14), Y = Application.GetRealWidth(12), - Width = Application.GetRealWidth(68 + 14), + Width = Application.GetRealWidth(82 + 14), Height = Application.GetRealWidth(28), BackgroundColor = 0x15FC9C04, - Radius = (uint)Application.GetRealHeight(14), + Radius = (uint)Application.GetRealWidth(14), BorderColor = 0x00FFFFFF, BorderWidth = 0, }; - infoView.AddChidren(infoView_ModeFreeView); + infoView.AddChidren(modeFreeView); - var infoView_ModeFree_IconButton = new Button() + modeFree_IconButton = new Button() { X = Application.GetRealWidth(8 + 14), Gravity = Gravity.CenterVertical, @@ -90,17 +223,17 @@ Height = Application.GetRealWidth(12), UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/ModeFree_False.png", }; - infoView_ModeFreeView.AddChidren(infoView_ModeFree_IconButton); + modeFreeView.AddChidren(modeFree_IconButton); - var infoView_ModeFree_TextButton = new Button() + modeFree_TextButton = new Button() { - X = Application.GetRealWidth(8 + 14 + 8 + 12), + X = Application.GetRealWidth(8 + 14 + 4 + 12), TextAlignment = TextAlignment.CenterLeft, TextSize = 14, TextColor = 0xFFFC9C04, Text = "鐢ㄧ數", }; - infoView_ModeFreeView.AddChidren(infoView_ModeFree_TextButton); + modeFreeView.AddChidren(modeFree_TextButton); var infoView_Temp_View = new FrameLayout() { @@ -111,7 +244,7 @@ }; infoView.AddChidren(infoView_Temp_View); - var btnTempValues = new Button() + btnTempValues = new Button() { Y = Application.GetRealWidth(34), Gravity = Gravity.CenterVertical, @@ -122,16 +255,18 @@ TextAlignment = TextAlignment.TopCenter, Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), "---"), }; -#if __IOS__ - btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(8); -#else - btnTempValues.Width = btnTempValues.GetTextWidth(); -#endif - btnTempValues.Gravity = Gravity.CenterHorizontal; - infoView_Temp_View.AddChidren(btnTempValues); - var btnTempValuesUint = new Button() + btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(6); + if (btnTempValues.Width > Application.GetRealWidth(80)) { - X = btnTempValues.Right - Application.GetRealWidth(4), + btnTempValues.TextSize = 28; + } + btnTempValues.Gravity = Gravity.CenterHorizontal; + + infoView_Temp_View.AddChidren(btnTempValues); + + btnTempValuesUint = new Button() + { + X = btnTempValues.Right, Y = Application.GetRealWidth(40), Height = Application.GetRealWidth(66), TextAlignment = TextAlignment.TopLeft, @@ -178,8 +313,8 @@ { Width = Application.GetRealWidth(16), }); - - var mode_EconomicView = new FrameLayout() + //鑺傝兘 + mode_EconomicView = new FrameLayout() { Width = Application.GetRealWidth(165), Height = Application.GetRealWidth(52), @@ -191,7 +326,7 @@ }; modeView.AddChidren(mode_EconomicView); - var mode_Economic_IconButton = new Button() + mode_Economic_IconButton = new Button() { Width = Application.GetRealWidth(20), Height = Application.GetRealWidth(20), @@ -201,7 +336,7 @@ }; mode_EconomicView.AddChidren(mode_Economic_IconButton); - var mode_Economic_TextButton = new Button() + mode_Economic_TextButton = new Button() { Width = Application.GetRealWidth(80), X = Application.GetRealWidth(73 + 8), @@ -217,8 +352,12 @@ Width = Application.GetRealWidth(13), }); + btnControlModeEconomic = new Button(); + mode_EconomicView.AddChidren(btnControlModeEconomic); + + //閫熺儹 - var mode_QuickHeatView = new FrameLayout() + mode_QuickHeatView = new FrameLayout() { Width = Application.GetRealWidth(165), Height = Application.GetRealWidth(52), @@ -230,7 +369,7 @@ }; modeView.AddChidren(mode_QuickHeatView); - var mode_QuickHeat_IconButton = new Button() + mode_QuickHeat_IconButton = new Button() { Width = Application.GetRealWidth(20), Height = Application.GetRealWidth(20), @@ -240,7 +379,8 @@ }; mode_QuickHeatView.AddChidren(mode_QuickHeat_IconButton); - var mode_QuickHeat_TextButton = new Button() + + mode_QuickHeat_TextButton = new Button() { Width = Application.GetRealWidth(80), X = Application.GetRealWidth(81), @@ -250,9 +390,13 @@ Text = "閫熺儹" }; mode_QuickHeatView.AddChidren(mode_QuickHeat_TextButton); + + btnControlModeQuickHeat = new Button(); + mode_QuickHeatView.AddChidren(btnControlModeQuickHeat); + #endregion - #region 璁剧疆娓╁害 + #region 娓╁害璁剧疆 var setTempView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, @@ -279,7 +423,7 @@ }; setTempView.AddChidren(setTemp_TextButtont); - var setTemp_Temp_ValuesTextButton = new Button() + setTemp_ValuesButton = new Button() { Y = Application.GetRealWidth(34), Gravity = Gravity.CenterVertical, @@ -290,16 +434,13 @@ TextAlignment = TextAlignment.TopCenter, Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "---"), }; -#if __IOS__ - setTemp_Temp_ValuesTextButton.Width = setTemp_Temp_ValuesTextButton.GetTextWidth() + Application.GetRealWidth(8); -#else - setTemp_Temp_ValuesTextButton.Width = setTemp_Temp_ValuesTextButton.GetTextWidth(); -#endif - setTemp_Temp_ValuesTextButton.Gravity = Gravity.CenterHorizontal; - setTempView.AddChidren(setTemp_Temp_ValuesTextButton); - var setTemp_Temp_ValuesUintButton = new Button() + setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); + setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal; + setTempView.AddChidren(setTemp_ValuesButton); + + setTemp_UintButton = new Button() { - X = setTemp_Temp_ValuesTextButton.Right - Application.GetRealWidth(4), + X = setTemp_ValuesButton.Right - Application.GetRealWidth(4), Y = Application.GetRealWidth(40), Height = Application.GetRealWidth(66), TextAlignment = TextAlignment.TopLeft, @@ -308,7 +449,7 @@ TextColor = CSS_Color.FirstLevelTitleColor, Text = "掳C" }; - setTempView.AddChidren(setTemp_Temp_ValuesUintButton); + setTempView.AddChidren(setTemp_UintButton); int setTempValue = 0; @@ -316,7 +457,7 @@ double dd = 0; double.TryParse(function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "--"), out dd); setTempValue = Convert.ToInt32(dd); - var setTemp_Temp_Bar = new DiyImageSeekBar() + setTemp_Bar = new DiyImageSeekBar() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(126 - 72), @@ -325,14 +466,15 @@ SeekBarViewHeight = Application.GetRealHeight(14), ThumbImagePath = "FunctionIcon/Acst/ThumbImage.png", ThumbImageHeight = Application.GetRealHeight(51), - ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? 0xFFFFB848 : CSS_Color.DividingLineColor, - MaxValue = 25, - Progress = setTempValue - 35, + ProgressBarColor = 0xFFFFB848 , + MaxValue = 60, + MinValue = 35, + Progress = setTempValue, SeekBarPadding = Application.GetRealWidth(20), IsProgressTextShow = false, - ProgressChangeDelayTime = 0, }; - setTempView.AddChidren(setTemp_Temp_Bar); + setTemp_Bar.ProgressChangeDelayTime = 0; + setTempView.AddChidren(setTemp_Bar); var setTemp_Temp_MinValuesTextButton = new Button() { @@ -361,423 +503,450 @@ setTempView.AddChidren(setTemp_Temp_MaxValuesTextButton); #endregion - contentView.AddChidren(new Button() - { - Height = Application.GetRealWidth(12), - }); #region flow 鐑按娴侀噺 - var flowView = new FrameLayout() + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null) { - 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); + contentView.AddChidren(new Button() + { + Height = Application.GetRealWidth(12), + }); - var 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 = "鐑按娴侀噺锛�0.3L/min", - IsBold = true, - }; - flowView.AddChidren(flow_ValuesButton); + #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); - 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); + 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_HotWaterVolumeValuesButton = new Button() - { - X = Application.GetRealWidth(343 - 116), - Y = Application.GetRealWidth(55), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(26), - Text = "24t", - TextAlignment = TextAlignment.CenterRight, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - }; - flowView.AddChidren(flow_HotWaterVolumeValuesButton); + 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_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 = 80, - 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_HeatRecoveryCapacitytProgressButton = 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 = "80%" - }; - flowView.AddChidren(flow_HeatRecoveryCapacitytProgressButton); - - var flow_HeatRecoveryCapacitytValuesButton = 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 = "19.2t" - }; - flowView.AddChidren(flow_HeatRecoveryCapacitytValuesButton); + 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); - var flow_ElectricDirectDriveQuantityTextButton = 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_ElectricDirectDriveQuantityTextButton); - var flow_ElectricDirectDriveQuantityProgressButton = 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 = "20%" - }; - flowView.AddChidren(flow_ElectricDirectDriveQuantityProgressButton); + 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_ElectricDirectDriveQuantityValuesButton = 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 = "4.8t" - }; - flowView.AddChidren(flow_ElectricDirectDriveQuantityValuesButton); + 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); - #endregion + 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); + + 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) + "%"; + } + 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() { Height = Application.GetRealWidth(8) }); + #endregion #region 绀句細璐$尞 Social contribution - contentView.AddChidren(new Button() + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != null + && function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.co2.ToString()) != null + && function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.trees.ToString()) != null) { - Height = Application.GetRealWidth(46), - Width = Application.GetRealWidth(100), - X = Application.GetRealWidth(16), - Text = "绀句細璐$尞", - TextAlignment = TextAlignment.CenterLeft, - TextSize = 16, - TextColor = CSS_Color.FirstLevelTitleColor, - IsBold = true - }); + contentView.AddChidren(new Button() + { + Height = Application.GetRealWidth(46), + Width = Application.GetRealWidth(100), + X = Application.GetRealWidth(16), + Text = "绀句細璐$尞", + TextAlignment = TextAlignment.CenterLeft, + TextSize = 16, + TextColor = CSS_Color.FirstLevelTitleColor, + IsBold = true + }); - var socialContributionView = new HorizontalScrolViewLayout() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(343), - Height = Application.GetRealHeight(142), - ScrollEnabled = false, - }; - contentView.AddChidren(socialContributionView); + var socialContributionView = new HorizontalScrolViewLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(142), + ScrollEnabled = false, + }; + contentView.AddChidren(socialContributionView); + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != null) + { + #region 鐑洖鏀惰妭鐢甸噺 + var socialContribution_InfoView_1 = new FrameLayout() + { + Width = Application.GetRealWidth(109), + Height = Application.GetRealWidth(130), + BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_1.png" + }; + socialContributionView.AddChidren(socialContribution_InfoView_1); - #region 鐑洖鏀惰妭鐢甸噺 - var socialContribution_InfoView_1 = new FrameLayout() - { - Width = Application.GetRealWidth(109), - Height = Application.GetRealWidth(130), - BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_1.png" - }; - socialContributionView.AddChidren(socialContribution_InfoView_1); + var socialContribution_Info1_IconButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(16), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_1.png" + }; + socialContribution_InfoView_1.AddChidren(socialContribution_Info1_IconButton); - var socialContribution_Info1_IconButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(16), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(36), - UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_1.png" - }; - socialContribution_InfoView_1.AddChidren(socialContribution_Info1_IconButton); + socialContribution_Info1_ValuesButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(25), + Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()), + TextSize = 18, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + IsBold = true, + }; + socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); + socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton); - var socialContribution_Info1_ValuesButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(25), - Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()), - TextSize = 18, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.BottomLeft, - IsBold = true, - }; + socialContribution_Info1_UintButton = new Button() + { + X = socialContribution_Info1_ValuesButton.Right, + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(50), + Height = Application.GetRealWidth(23), + Text = "kwh", + TextSize = 12, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + }; + socialContribution_InfoView_1.AddChidren(socialContribution_Info1_UintButton); + + var socialContribution_Info1_TipButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(98), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(17), + Text = "鐑洖鏀惰妭鐢甸噺", + TextSize = 12, + TextColor = 0xFF798394, + TextAlignment = TextAlignment.CenterLeft, + }; + socialContribution_InfoView_1.AddChidren(socialContribution_Info1_TipButton); + #endregion + + socialContributionView.AddChidren(new Button() + { + Width = Application.GetRealWidth(8), + }); + } + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.co2.ToString()) != null) + { + #region CO2鍑忔帓閲� + var socialContribution_InfoView_2 = new FrameLayout() + { + Width = Application.GetRealWidth(109), + Height = Application.GetRealWidth(130), + BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_2.png" + }; + socialContributionView.AddChidren(socialContribution_InfoView_2); + + var socialContribution_Info2_IconButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(16), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_2.png" + }; + socialContribution_InfoView_2.AddChidren(socialContribution_Info2_IconButton); + + socialContribution_Info2_ValuesButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(25), + Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()), + TextSize = 18, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + IsBold = true, + }; + socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); + socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton); + + + socialContribution_Info2_UintButton = new Button() + { + X = socialContribution_Info2_ValuesButton.Right, + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(50), + Height = Application.GetRealWidth(23), + Text = "鍚�", + TextSize = 12, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + }; #if __IOS__ - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); + socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66); #endif - socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton); + socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton); - var socialContribution_Info1_UintButton = new Button() - { - X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(50), - Height = Application.GetRealWidth(23), - Text = "kwh", - TextSize = 12, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.BottomLeft, - }; - socialContribution_InfoView_1.AddChidren(socialContribution_Info1_UintButton); + var socialContribution_Info2_TipButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(98), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(17), + Text = "CO2鍑忔帓閲�", + TextSize = 12, + TextColor = 0xFF798394, + TextAlignment = TextAlignment.CenterLeft, + }; + socialContribution_InfoView_2.AddChidren(socialContribution_Info2_TipButton); + #endregion - var socialContribution_Info1_TipButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(98), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(17), - Text = "鐑洖鏀惰妭鐢甸噺", - TextSize = 12, - TextColor = 0xFF798394, - TextAlignment = TextAlignment.CenterLeft, - }; - socialContribution_InfoView_1.AddChidren(socialContribution_Info1_TipButton); - #endregion + socialContributionView.AddChidren(new Button() + { + Width = Application.GetRealWidth(8), + }); + } + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.trees.ToString()) != null) + { + #region 绛夋晥妞嶆爲閲� + var socialContribution_InfoView_3 = new FrameLayout() + { + Width = Application.GetRealWidth(109), + Height = Application.GetRealWidth(130), + BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_3.png" + }; + socialContributionView.AddChidren(socialContribution_InfoView_3); - socialContributionView.AddChidren(new Button() - { - Width = Application.GetRealWidth(8), - }); + var socialContribution_Info3_IconButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(16), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_3.png" + }; + socialContribution_InfoView_3.AddChidren(socialContribution_Info3_IconButton); - #region CO2鍑忔帓閲� - var socialContribution_InfoView_2 = new FrameLayout() - { - Width = Application.GetRealWidth(109), - Height = Application.GetRealWidth(130), - BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_2.png" - }; - socialContributionView.AddChidren(socialContribution_InfoView_2); + socialContribution_Info3_ValuesButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(25), + Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()), + TextSize = 18, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + IsBold = true, + }; + socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); + socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton); - var socialContribution_Info2_IconButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(16), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(36), - UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_2.png" - }; - socialContribution_InfoView_2.AddChidren(socialContribution_Info2_IconButton); - - var socialContribution_Info2_ValuesButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(25), - Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()), - TextSize = 18, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.BottomLeft, - IsBold = true, - }; + socialContribution_Info3_UintButton = new Button() + { + X = socialContribution_Info3_ValuesButton.Right, + Y = Application.GetRealWidth(68), + Width = Application.GetRealWidth(50), + Height = Application.GetRealWidth(23), + Text = "妫�", + TextSize = 12, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.BottomLeft, + }; #if __IOS__ - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); + socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66); #endif - socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton); + socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton); - var socialContribution_Info2_UintButton = new Button() - { - X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(50), - Height = Application.GetRealWidth(23), - Text = "鍚�", - TextSize = 12, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.BottomLeft, - }; - socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton); - - var socialContribution_Info2_TipButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(98), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(17), - Text = "CO2鍑忔帓閲�", - TextSize = 12, - TextColor = 0xFF798394, - TextAlignment = TextAlignment.CenterLeft, - }; - socialContribution_InfoView_2.AddChidren(socialContribution_Info2_TipButton); - #endregion - - socialContributionView.AddChidren(new Button() - { - Width = Application.GetRealWidth(8), - }); - - #region 绛夋晥妞嶆爲閲� - var socialContribution_InfoView_3 = new FrameLayout() - { - Width = Application.GetRealWidth(109), - Height = Application.GetRealWidth(130), - BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_3.png" - }; - socialContributionView.AddChidren(socialContribution_InfoView_3); - - var socialContribution_Info3_IconButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(16), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(36), - UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_3.png" - }; - socialContribution_InfoView_3.AddChidren(socialContribution_Info3_IconButton); - - var socialContribution_Info3_ValuesButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(36), - Height = Application.GetRealWidth(25), - Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()), - TextSize = 18, - TextColor = CSS_Color.FirstLevelTitleColor, - 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() - { - X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4), - Y = Application.GetRealWidth(68), - Width = Application.GetRealWidth(50), - Height = Application.GetRealWidth(23), - Text = "妫�", - TextSize = 12, - TextColor = CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.BottomLeft, - }; - socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton); - - var socialContribution_Info3_TipButton = new Button() - { - X = Application.GetRealWidth(12), - Y = Application.GetRealWidth(98), - Width = Application.GetRealWidth(100), - Height = Application.GetRealWidth(17), - Text = "绛夋晥妞嶆爲閲�", - TextSize = 12, - TextColor = 0xFF798394, - TextAlignment = TextAlignment.CenterLeft, - }; - socialContribution_InfoView_3.AddChidren(socialContribution_Info3_TipButton); - #endregion - + var socialContribution_Info3_TipButton = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(98), + Width = Application.GetRealWidth(100), + Height = Application.GetRealWidth(17), + Text = "绛夋晥妞嶆爲閲�", + TextSize = 12, + TextColor = 0xFF798394, + TextAlignment = TextAlignment.CenterLeft, + }; + socialContribution_InfoView_3.AddChidren(socialContribution_Info3_TipButton); + #endregion + } + } #endregion } - + /// <summary> + /// 鍔犺浇搴曢儴鍖哄煙 + /// </summary> private void initBottomView() { - var btnPowerControl = new Button() + btnPowerControl = new Button() { Width = Application.GetRealWidth(50), Height = Application.GetRealWidth(50), Gravity = Gravity.CenterHorizontal, Y = Application.GetRealWidth(16), + SelectedImagePath = "FunctionIcon/Acst/orange/PowerIcon.png", UnSelectedImagePath = "FunctionIcon/Acst/grey/PowerOffIcon.png", - SelectedImagePath = $"FunctionIcon/Acst/blue/PowerIcon.png", IsSelected = function.trait_on_off.curValue.ToString() == "on" }; bottomView.AddChidren(btnPowerControl); - btnPowerControl.MouseUpEventHandler = (sender, e) => { + btnPowerControl.MouseUpEventHandler = (sender, e) => + { btnPowerControl.IsSelected = !btnPowerControl.IsSelected; - new System.Threading.Thread(() => { + new System.Threading.Thread(() => + { Dictionary<string, string> d = new Dictionary<string, string>(); d.Add(FunctionAttributeKey.OnOff, btnPowerControl.IsSelected ? "on" : "off"); Control.Ins.SendWriteCommand(function, d); @@ -787,9 +956,424 @@ } - public void UpdateStatus(Function temp) + /// <summary> + /// 鍒濆鍖栨帶鍒朵簨浠� + /// </summary> + private void initControlEvent() + { + //鑺傝兘妯″紡鎺у埗 + btnControlModeEconomic.MouseUpEventHandler = (sender, e) => + { + new System.Threading.Thread(() => + { + var dic = new Dictionary<string, string>(); + dic.Add(WaterHeaterJinmao_AttrEnum.mode.ToString(), WaterHeaterJinmao_Attr_ModeEnum.economic.ToString()); + Control.Ins.SendWriteCommand(function, dic); + function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString(), WaterHeaterJinmao_Attr_ModeEnum.economic.ToString()); + Application.RunOnMainThread(() => + { + updateModeUI(); + }); + }) + { IsBackground = true }.Start(); + }; + //閫熺儹妯″紡鎺у埗 + btnControlModeQuickHeat.MouseUpEventHandler = (sender, e) => + { + new System.Threading.Thread(() => + { + var dic = new Dictionary<string, string>(); + dic.Add(WaterHeaterJinmao_AttrEnum.mode.ToString(), WaterHeaterJinmao_Attr_ModeEnum.quick_heat.ToString()); + Control.Ins.SendWriteCommand(function, dic); + function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString(), WaterHeaterJinmao_Attr_ModeEnum.quick_heat.ToString()); + Application.RunOnMainThread(() => + { + updateModeUI(); + }); + }) + { IsBackground = true }.Start(); + }; + setTemp_Bar.OnStartTrackingTouchEvent = (sender, e) => + { + contentView.ScrollEnabled = false; + }; + //璁剧疆娓╁害璋冭妭 + setTemp_Bar.OnStopTrackingTouchEvent = (sender, e) => + { + contentView.ScrollEnabled = true; +#if __IOS__ + setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); +#else + 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>(); + dic.Add(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), setTemp_Bar.Progress.ToString()); + Control.Ins.SendWriteCommand(function, dic); + function.SetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), setTemp_Bar.Progress.ToString()); + }) + { IsBackground = true }.Start(); + }; + setTemp_Bar.OnProgressChangedEvent = (sender, e) => { + setTemp_ValuesButton.Text = e.ToString(); + }; + + //寮�鍏虫帶鍒� + btnPowerControl.MouseUpEventHandler = (sender, e) => + { + btnPowerControl.IsSelected = !btnPowerControl.IsSelected; + function.SetAttrState(FunctionAttributeKey.OnOff.ToString(), btnPowerControl.IsSelected ? "on" : "off"); + + new System.Threading.Thread(() => + { + var dic = new Dictionary<string, string>(); + dic.Add(FunctionAttributeKey.OnOff.ToString(), function.GetAttrState(FunctionAttributeKey.OnOff.ToString())); + Control.Ins.SendWriteCommand(function, dic); + }) + { IsBackground = true }.Start(); + }; + } + + + /// <summary> + /// 鏇存柊鐣岄潰鐘舵�� + /// </summary> + /// <param name="temp"></param> + public static void UpdateStatus() + { + if (bodyView == null) + { + return; + } + //鍏嶈垂鐑按 + Application.RunOnMainThread(() => + { + try + { + bodyView.updateFreeMode(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateTemp(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateModeUI(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateSetTemp(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateFlow(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateVolume(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateSocialContribution1(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateSocialContribution2(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updateSocialContribution3(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + try + { + bodyView.updatePowerButton(); + } + catch (Exception ex) + { + MainPage.Log("Error", $"閲戣寕鐑按鎺т欢鏇存柊寮傚父锛歿ex.Message}"); + } + }); + } + + /// <summary> + /// 鏇存柊鍏嶈垂鐑按妯″紡鐘舵�乁I + /// </summary> + private void updateFreeMode() + { + if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) == "true") + { + modeFreeView.BackgroundColor = 0x1500C22D; + modeFree_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/ModeFree_True.png"; + modeFree_TextButton.Text = "鐑洖鏀�"; + modeFree_TextButton.TextColor = 0xFF00C22D; + } + else + { + modeFreeView.BackgroundColor = 0x15FC9C04; + modeFree_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/ModeFree_False.png"; + modeFree_TextButton.Text = "鐢ㄧ數"; + modeFree_TextButton.TextColor = 0xFFFC9C04; + } + } + /// <summary> + /// 鏇存柊鐑按娓╁害UI + /// </summary> + private void updateTemp() + { + btnTempValues.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), "---"); +#if __IOS__ + btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(6); +#else + btnTempValues.Width = btnTempValues.GetTextWidth(); +#endif + if (btnTempValues.Width > Application.GetRealWidth(80)) + { + btnTempValues.TextSize = 28; + } + btnTempValues.Gravity = Gravity.CenterHorizontal; +#if __IOS__ + btnTempValuesUint.X = btnTempValues.Right - Application.GetRealWidth(4); +#else + btnTempValuesUint.X = btnTempValues.Right ; +#endif + } + + /// <summary> + /// 鏇存柊妯″紡UI + /// </summary> + private void updateModeUI() + { + if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) == WaterHeaterJinmao_Attr_ModeEnum.economic.ToString()) + { + //鑺傝兘 + mode_EconomicView.BorderColor = 0xFF00C22D; + mode_EconomicView.BackgroundColor = 0xFFEBFAEE; + mode_Economic_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/Mode_Economic_On.png"; + mode_Economic_TextButton.TextColor = CSS_Color.FirstLevelTitleColor; + + //閫熺儹 + mode_QuickHeatView.BorderColor = 0x0000C22D; + mode_QuickHeatView.BorderWidth = (uint)Application.GetRealWidth(1); + mode_QuickHeatView.BackgroundColor = CSS_Color.MainBackgroundColor; + mode_QuickHeat_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/Mode_QuickHeat.png"; + mode_QuickHeat_TextButton.TextColor = CSS_Color.TextualColor; + } + else if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) == WaterHeaterJinmao_Attr_ModeEnum.quick_heat.ToString()) + { + //鑺傝兘 + mode_EconomicView.BorderColor = 0x0000C22D; + mode_EconomicView.BackgroundColor = CSS_Color.MainBackgroundColor; + mode_Economic_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/Mode_Economic.png"; + mode_Economic_TextButton.TextColor = CSS_Color.TextualColor; + + //閫熺儹 + mode_QuickHeatView.BorderColor = 0xFFFC9C04; + mode_QuickHeatView.BackgroundColor = 0xFFFFF7EB; + mode_QuickHeat_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/Mode_QuickHeat_On.png"; + mode_QuickHeat_TextButton.TextColor = CSS_Color.FirstLevelTitleColor; + } + } + + /// <summary> + /// 鏇存柊鐑按鍣ㄨ缃俯搴I + /// </summary> + private void updateSetTemp() + { + setTemp_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "---"); +#if __IOS__ + setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); +#else + 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 + + double dd = 35; + double.TryParse(function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "0"), out dd); + setTemp_Bar.Progress = Convert.ToInt32(dd); + + } + + /// <summary> + /// 鏇存柊鐑按娴侀噺鏁版嵁UI + /// </summary> + private void updateFlow() + { + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null) + { + flow_ValuesButton.Text = "鐑按娴侀噺锛�" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min"; + } + } + + /// <summary> + /// 鏇存柊鐑按鎬婚噺鏁版嵁UI + /// </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; + double.TryParse(volumeString, out volume); + double.TryParse(recyclVolumeString, out recyclVolume); + recyclVolumePercent = (int)(recyclVolume / volume * 100); + + flow_VolumeButton.Text = volumeString + "t"; + flow_ValuesBar.Progress = recyclVolumePercent; + flow_HeatRecoveryProgressButton.Text = recyclVolumePercent + "%"; + flow_HeatRecoverytValuesButton.Text = recyclVolume + "t"; + if (volume > 0) + { + flow_ElectricDriveProgressButton.Text = ((int)(100 - recyclVolumePercent)) + "%"; + } + flow_ElectricDriveValuesButton.Text = (((int)(volume * 100) - (int)(recyclVolume * 100)) / 100.0) + "t"; + } + + /// <summary> + /// 鏇存柊绀句細璐$尞1鏁版嵁UI + /// </summary> + private void updateSocialContribution1() { + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != null) + { + try + { + socialContribution_Info1_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.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 + } + catch { } + } + } + /// <summary> + /// 鏇存柊绀句細璐�2鐚暟鎹甎I + /// </summary> + private void updateSocialContribution2() + { + + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.co2.ToString()) != null) + { + try + { + 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 + } + catch { } + } + } + /// <summary> + /// 鏇存柊绀句細璐�3鐚暟鎹甎I + /// </summary> + private void updateSocialContribution3() + { + if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.trees.ToString()) != null) + { + try + { + 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(23); + } +#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 + } + catch { } + } + } + + /// <summary> + /// 鏇存柊寮�鍏虫寜閽姸鎬� + /// </summary> + private void updatePowerButton() + { + btnPowerControl.IsSelected = function.GetAttrState(FunctionAttributeKey.OnOff.ToString()) == "on"; } } } -- Gitblit v1.8.0