| | |
| | | Button flow_ElectricDriveValuesButton; |
| | | string volumeString = string.Empty; |
| | | string recyclVolumeString = string.Empty; |
| | | double volume = 0; |
| | | double recyclVolume = 0; |
| | | double volume = 0.00; |
| | | double recyclVolume = 0.00; |
| | | int recyclVolumePercent = 0; |
| | | |
| | | /// <summary> |
| | |
| | | initBottomView(); |
| | | initControlEvent(); |
| | | Control.Ins.SendReadCommand(function); |
| | | |
| | | UpdateStatus(); |
| | | } |
| | | /// <summary> |
| | | /// 加载内容区域 |
| | |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(16) }); |
| | | |
| | | #region 热水器状态 |
| | | var infoView = new FrameLayout() |
| | | FrameLayout infoView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | |
| | | { |
| | | 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.GetRealWidth(14), |
| | |
| | | TextAlignment = TextAlignment.TopCenter, |
| | | Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), "---"), |
| | | }; |
| | | btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(8); |
| | | btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(6); |
| | | if (btnTempValues.Width > Application.GetRealWidth(80)) |
| | | { |
| | | btnTempValues.TextSize = 28; |
| | | } |
| | | btnTempValues.Gravity = Gravity.CenterHorizontal; |
| | | |
| | | infoView_Temp_View.AddChidren(btnTempValues); |
| | | |
| | | btnTempValuesUint = new Button() |
| | | { |
| | | X = btnTempValues.Right - Application.GetRealWidth(4), |
| | | X = btnTempValues.Right, |
| | | Y = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(66), |
| | | TextAlignment = TextAlignment.TopLeft, |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 设置温度 |
| | | #region 温度设置 |
| | | var setTempView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | |
| | | 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, |
| | | }; |
| | | setTemp_Bar.ProgressChangeDelayTime = 0; |
| | | setTempView.AddChidren(setTemp_Bar); |
| | | |
| | | var setTemp_Temp_MinValuesTextButton = new Button() |
| | |
| | | }; |
| | | flowView.AddChidren(flow_HeatRecoverytValuesButton); |
| | | |
| | | |
| | | |
| | | var flow_ElectricDriveTextButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(343 - 116), |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 14, |
| | | TextColor = 0xFFFC9C04, |
| | | Text = "电直驱量" |
| | | Text = "电直驱量", |
| | | }; |
| | | flowView.AddChidren(flow_ElectricDriveTextButton); |
| | | |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 14, |
| | | TextColor = 0xFFFC9C04, |
| | | Text = (100 - recyclVolumePercent) + "%" |
| | | Text = "0%" |
| | | }; |
| | | if(volume > 0) |
| | | { |
| | | flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%"; |
| | | } |
| | | flowView.AddChidren(flow_ElectricDriveProgressButton); |
| | | |
| | | flow_ElectricDriveValuesButton = new Button() |
| | |
| | | |
| | | socialContribution_Info1_UintButton = new Button() |
| | | { |
| | | X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4), |
| | | X = socialContribution_Info1_ValuesButton.Right , |
| | | Y = Application.GetRealWidth(68), |
| | | Width = Application.GetRealWidth(50), |
| | | Height = Application.GetRealWidth(23), |
| | |
| | | |
| | | socialContribution_Info2_UintButton = new Button() |
| | | { |
| | | X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4), |
| | | X = socialContribution_Info2_ValuesButton.Right , |
| | | Y = Application.GetRealWidth(68), |
| | | Width = Application.GetRealWidth(50), |
| | | Height = Application.GetRealWidth(23), |
| | |
| | | |
| | | socialContribution_Info3_UintButton = new Button() |
| | | { |
| | | X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4), |
| | | X = socialContribution_Info3_ValuesButton.Right , |
| | | Y = Application.GetRealWidth(68), |
| | | Width = Application.GetRealWidth(50), |
| | | Height = Application.GetRealWidth(23), |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "FunctionIcon/Acst/grey/PowerOffIcon.png", |
| | | SelectedImagePath = $"FunctionIcon/Acst/blue/PowerIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Acst/blue/PowerIcon.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | }; |
| | | bottomView.AddChidren(btnPowerControl); |
| | |
| | | //节能模式控制 |
| | | btnControlModeEconomic.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) != WaterHeaterJinmao_Attr_ModeEnum.economic.ToString()) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | //速热模式控制 |
| | | btnControlModeQuickHeat.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) != WaterHeaterJinmao_Attr_ModeEnum.quick_heat.ToString()) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | { 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; |
| | | setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var dic = new Dictionary<string, string>(); |
| | |
| | | /// 更新界面状态 |
| | | /// </summary> |
| | | /// <param name="temp"></param> |
| | | public static void UpdateStatus(Function temp) |
| | | public static void UpdateStatus() |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | //免费热水 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())) |
| | | { |
| | | bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateFreeMode(); |
| | | }); |
| | | } |
| | | //热水温度 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())) |
| | | { |
| | | bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateTemp(); |
| | | }); |
| | | } |
| | | //热水器模式 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())) |
| | | { |
| | | bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateModeUI(); |
| | | }); |
| | | } |
| | | //热水器设置温度 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())) |
| | | { |
| | | bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateSetTemp(); |
| | | }); |
| | | } |
| | | //热水流量 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString())) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateFlow(); |
| | | }); |
| | | } |
| | | //热水总量 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) || |
| | | bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString())) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | bodyView.updateVolume(); |
| | | }); |
| | | } |
| | | //社会贡献-节电量 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString())) |
| | | { |
| | | bodyView.updateSocialContribution1(); |
| | | } |
| | | //社会贡献-co2 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString())) |
| | | { |
| | | bodyView.updateSocialContribution2(); |
| | | } |
| | | //社会贡献-植树 |
| | | if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString())) |
| | | { |
| | | bodyView.updateSocialContribution3(); |
| | | } |
| | | //开关按钮 |
| | | if (bodyView.function.GetAttrState(FunctionAttributeKey.OnOff.ToString()) != temp.GetAttrState(FunctionAttributeKey.OnOff.ToString())) |
| | | { |
| | | bodyView.updatePowerButton(); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private void updateFreeMode() |
| | | { |
| | | if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) != "true") |
| | | if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) == "true") |
| | | { |
| | | modeFreeView.BackgroundColor = 0x1500C22D; |
| | | modeFreeView.Width = Width = Application.GetRealWidth(82 + 14); |
| | | modeFree_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/ModeFree_True.png"; |
| | | modeFree_TextButton.Text = "热回收"; |
| | | modeFree_TextButton.TextColor = 0xFF00C22D; |
| | |
| | | else |
| | | { |
| | | modeFreeView.BackgroundColor = 0x15FC9C04; |
| | | modeFreeView.Width = Width = Application.GetRealWidth(68 + 14); |
| | | modeFree_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/ModeFree_False.png"; |
| | | modeFree_TextButton.Text = "用电"; |
| | | modeFree_TextButton.TextColor = 0xFFFC9C04; |
| | |
| | | { |
| | | btnTempValues.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), "---"); |
| | | #if __IOS__ |
| | | btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(8); |
| | | 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; |
| | | |
| | | btnTempValuesUint.X = btnTempValues.Right - Application.GetRealWidth(4); |
| | | btnTempValuesUint.X = btnTempValues.Right ; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | #endif |
| | | setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal; |
| | | |
| | | setTemp_UintButton.X = setTemp_ValuesButton.Right - Application.GetRealWidth(4); |
| | | setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4); |
| | | |
| | | |
| | | double dd = 0; |
| | | double dd = 35; |
| | | double.TryParse(function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "0"), out dd); |
| | | setTemp_Bar.Progress = Convert.ToInt32(dd) - 35; |
| | | setTemp_Bar.Progress = Convert.ToInt32(dd); |
| | | |
| | | } |
| | | |
| | |
| | | flow_ValuesBar.Progress = recyclVolumePercent; |
| | | flow_HeatRecoveryProgressButton.Text = recyclVolumePercent + "%"; |
| | | flow_HeatRecoverytValuesButton.Text = recyclVolume + "t"; |
| | | flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%"; |
| | | flow_ElectricDriveValuesButton.Text = (volume - recyclVolume) + "t"; |
| | | if (volume > 0) |
| | | { |
| | | flow_ElectricDriveProgressButton.Text = ((int)(100 - recyclVolumePercent)) + "%"; |
| | | } |
| | | flow_ElectricDriveValuesButton.Text = (((int)(volume * 100) - (int)(recyclVolume * 100)) / 100.0) + "t"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | #else |
| | | socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4); |
| | | if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61)) |
| | | { |
| | | socialContribution_Info1_ValuesButton.TextSize = 14; |
| | | #if __IOS__ |
| | | socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); |
| | | #else |
| | | socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25); |
| | | } |
| | | #if __IOS__ |
| | | socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right ; |
| | | #else |
| | | socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2); |
| | | #endif |
| | | } |
| | | /// <summary> |
| | | /// 更新社会贡2献数据UI |
| | | /// </summary> |
| | | private void updateSocialContribution2() |
| | | { |
| | | socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()); |
| | | socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()); |
| | | #if __IOS__ |
| | | socialContribution_Info3_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); |
| | | socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); |
| | | #else |
| | | socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4); |
| | | if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61)) |
| | | { |
| | | socialContribution_Info2_ValuesButton.TextSize = 14; |
| | | #if __IOS__ |
| | | socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); |
| | | #else |
| | | socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | socialContribution_Info2_UintButton.Y = socialContribution_Info2_UintButton.Y - Application.GetRealWidth(4); |
| | | } |
| | | #if __IOS__ |
| | | socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right; |
| | | #else |
| | | socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2); |
| | | #endif |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | #else |
| | | socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4); |
| | | if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61)) |
| | | { |
| | | socialContribution_Info3_ValuesButton.TextSize = 14; |
| | | #if __IOS__ |
| | | socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); |
| | | #else |
| | | socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); |
| | | #endif |
| | | } |
| | | #if __IOS__ |
| | | socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right; |
| | | #else |
| | | socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2); |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | btnPowerControl.IsSelected = function.GetAttrState(FunctionAttributeKey.OnOff.ToString()) == "on"; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |