wxr
2024-09-10 8e940d7f0c873cfedf7f6d8c885be98b96f1d046
HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs
@@ -180,9 +180,10 @@
            initContentView();
            initBottomView();
            initControlEvent();
            Control.Ins.SendReadCommand(function);
            UpdateStatus();
            Control.Ins.SendReadCommand(function);
        }
        /// <summary>
        /// 加载内容区域
@@ -505,177 +506,181 @@
            setTempView.AddChidren(setTemp_Temp_MaxValuesTextButton);
            #endregion
            contentView.AddChidren(new Button()
            if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null)
            {
                Height = Application.GetRealWidth(12),
            });
                contentView.AddChidren(new Button()
                {
                    Height = Application.GetRealWidth(12),
                });
            #region flow 热水流量
            var flowView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(186),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(12),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
            contentView.AddChidren(flowView);
                #region flow 热水流量
                var flowView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealWidth(186),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealHeight(12),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 0,
                };
                contentView.AddChidren(flowView);
            flow_ValuesButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(14),
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealWidth(25),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 16,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = "热水流量:" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min",
                IsBold = true,
            };
            flowView.AddChidren(flow_ValuesButton);
                flow_ValuesButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(14),
                    Width = Application.GetRealWidth(200),
                    Height = Application.GetRealWidth(25),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 16,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    Text = "热水流量:" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min",
                    IsBold = true,
                };
                flowView.AddChidren(flow_ValuesButton);
            var flow_HotWaterVolumeTextButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(55),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(20),
                Text = "热水量",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            flowView.AddChidren(flow_HotWaterVolumeTextButton);
                var flow_HotWaterVolumeTextButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(55),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(20),
                    Text = "热水量",
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                flowView.AddChidren(flow_HotWaterVolumeTextButton);
            string volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString());
            string recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString());
            double volume = 0;
            double.TryParse(volumeString, out volume);
            double recyclVolume = 0;
            double.TryParse(recyclVolumeString, out recyclVolume);
            int recyclVolumePercent = (int)(recyclVolume / volume * 100);
                string volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString());
                string recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString());
                double volume = 0;
                double.TryParse(volumeString, out volume);
                double recyclVolume = 0;
                double.TryParse(recyclVolumeString, out recyclVolume);
                int recyclVolumePercent = (int)(recyclVolume / volume * 100);
            flow_VolumeButton = new Button()
            {
                X = Application.GetRealWidth(343 - 116),
                Y = Application.GetRealWidth(55),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(26),
                Text = volumeString + "t",
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            flowView.AddChidren(flow_VolumeButton);
                flow_VolumeButton = new Button()
                {
                    X = Application.GetRealWidth(343 - 116),
                    Y = Application.GetRealWidth(55),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(26),
                    Text = volumeString + "t",
                    TextAlignment = TextAlignment.CenterRight,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                };
                flowView.AddChidren(flow_VolumeButton);
            flow_ValuesBar = new DiyImageSeekBar()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealWidth(79),
                Width = Application.GetRealWidth(Application.DesignWidth - 64),
                Height = Application.GetRealHeight(8),
                SeekBarViewHeight = Application.GetRealHeight(8),
                ThumbImageHeight = Application.GetRealHeight(0),
                ProgressBarColor = 0xFF42D163,
                SeekBarBackgroundColor = 0xFFFFB848,
                MaxValue = 100,
                Progress = recyclVolumePercent,
                SeekBarPadding = Application.GetRealWidth(0),
                IsProgressTextShow = false,
                ProgressChangeDelayTime = 0,
                Enable = false,
                IsClickable = false,
            };
            flowView.AddChidren(flow_ValuesBar);
                flow_ValuesBar = new DiyImageSeekBar()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealWidth(79),
                    Width = Application.GetRealWidth(Application.DesignWidth - 64),
                    Height = Application.GetRealHeight(8),
                    SeekBarViewHeight = Application.GetRealHeight(8),
                    ThumbImageHeight = Application.GetRealHeight(0),
                    ProgressBarColor = 0xFF42D163,
                    SeekBarBackgroundColor = 0xFFFFB848,
                    MaxValue = 100,
                    Progress = recyclVolumePercent,
                    SeekBarPadding = Application.GetRealWidth(0),
                    IsProgressTextShow = false,
                    ProgressChangeDelayTime = 0,
                    Enable = false,
                    IsClickable = false,
                };
                flowView.AddChidren(flow_ValuesBar);
            var flow_HeatRecoveryCapacitytTextButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(103),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(20),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                TextColor = 0xFF00C22D,
                Text = "热回收量"
            };
            flowView.AddChidren(flow_HeatRecoveryCapacitytTextButton);
                var flow_HeatRecoveryCapacitytTextButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(103),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(20),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 14,
                    TextColor = 0xFF00C22D,
                    Text = "热回收量"
                };
                flowView.AddChidren(flow_HeatRecoveryCapacitytTextButton);
            flow_HeatRecoveryProgressButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(125),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(22),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                TextColor = 0xFF00C22D,
                Text = recyclVolumePercent + "%"
            };
            flowView.AddChidren(flow_HeatRecoveryProgressButton);
                flow_HeatRecoveryProgressButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(125),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(22),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 14,
                    TextColor = 0xFF00C22D,
                    Text = recyclVolumePercent + "%"
                };
                flowView.AddChidren(flow_HeatRecoveryProgressButton);
            flow_HeatRecoverytValuesButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(148),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(22),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = recyclVolume + "t"
            };
            flowView.AddChidren(flow_HeatRecoverytValuesButton);
                flow_HeatRecoverytValuesButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = Application.GetRealWidth(148),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(22),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 14,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    Text = recyclVolume + "t"
                };
                flowView.AddChidren(flow_HeatRecoverytValuesButton);
            var flow_ElectricDriveTextButton = new Button()
            {
                X = Application.GetRealWidth(343 - 116),
                Y = Application.GetRealWidth(103),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(20),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = 14,
                TextColor = 0xFFFC9C04,
                Text = "电直驱量",
            };
            flowView.AddChidren(flow_ElectricDriveTextButton);
                var flow_ElectricDriveTextButton = new Button()
                {
                    X = Application.GetRealWidth(343 - 116),
                    Y = Application.GetRealWidth(103),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(20),
                    TextAlignment = TextAlignment.CenterRight,
                    TextSize = 14,
                    TextColor = 0xFFFC9C04,
                    Text = "电直驱量",
                };
                flowView.AddChidren(flow_ElectricDriveTextButton);
            flow_ElectricDriveProgressButton = new Button()
            {
                X = Application.GetRealWidth(343 - 116),
                Y = Application.GetRealWidth(125),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(22),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = 14,
                TextColor = 0xFFFC9C04,
                Text = "0%"
            };
            if(volume > 0)
            {
                flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%";
                flow_ElectricDriveProgressButton = new Button()
                {
                    X = Application.GetRealWidth(343 - 116),
                    Y = Application.GetRealWidth(125),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(22),
                    TextAlignment = TextAlignment.CenterRight,
                    TextSize = 14,
                    TextColor = 0xFFFC9C04,
                    Text = "0%"
                };
                if (volume > 0)
                {
                    flow_ElectricDriveProgressButton.Text = (100 - recyclVolumePercent) + "%";
                }
                flowView.AddChidren(flow_ElectricDriveProgressButton);
                flow_ElectricDriveValuesButton = new Button()
                {
                    X = Application.GetRealWidth(343 - 116),
                    Y = Application.GetRealWidth(148),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetRealWidth(22),
                    TextAlignment = TextAlignment.CenterRight,
                    TextSize = 14,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    Text = (volume - recyclVolume) + "t"
                };
                flowView.AddChidren(flow_ElectricDriveValuesButton);
                #endregion
            }
            flowView.AddChidren(flow_ElectricDriveProgressButton);
            flow_ElectricDriveValuesButton = new Button()
            {
                X = Application.GetRealWidth(343 - 116),
                Y = Application.GetRealWidth(148),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(22),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = 14,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = (volume - recyclVolume) + "t"
            };
            flowView.AddChidren(flow_ElectricDriveValuesButton);
            #endregion
            contentView.AddChidren(new Button()
            {
@@ -816,6 +821,9 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.BottomLeft,
            };
#if __IOS__
            socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66);
#endif
            socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton);
            var socialContribution_Info2_TipButton = new Button()
@@ -882,6 +890,9 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.BottomLeft,
            };
#if __IOS__
            socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66);
#endif
            socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton);
            var socialContribution_Info3_TipButton = new Button()
@@ -988,10 +999,15 @@
#if __IOS__
                setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth();
                setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth();
#endif
                setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal;
#if __IOS__
                setTemp_UintButton.X = setTemp_ValuesButton.Right - Application.GetRealWidth(4);
#else
                setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4);
#endif
                new System.Threading.Thread(() =>
                {
                    var dic = new Dictionary<string, string>();
@@ -1035,16 +1051,22 @@
            //免费热水
            Application.RunOnMainThread(() =>
            {
                bodyView.updateFreeMode();
                bodyView.updateTemp();
                bodyView.updateModeUI();
                bodyView.updateSetTemp();
                bodyView.updateFlow();
                bodyView.updateVolume();
                bodyView.updateSocialContribution1();
                bodyView.updateSocialContribution2();
                bodyView.updateSocialContribution3();
                bodyView.updatePowerButton();
                try
                {
                    bodyView.updateFreeMode();
                    bodyView.updateTemp();
                    bodyView.updateModeUI();
                    bodyView.updateSetTemp();
                    bodyView.updateFlow();
                    bodyView.updateVolume();
                    bodyView.updateSocialContribution1();
                    bodyView.updateSocialContribution2();
                    bodyView.updateSocialContribution3();
                    bodyView.updatePowerButton();
                }catch  (Exception ex)
                {
                    MainPage.Log("Error", $"金茂热水控件更新异常:{ex.Message}");
                }
            });
        }
@@ -1084,8 +1106,11 @@
                btnTempValues.TextSize = 28;
            }
            btnTempValues.Gravity = Gravity.CenterHorizontal;
#if __IOS__
            btnTempValuesUint.X = btnTempValues.Right - Application.GetRealWidth(4);
#else
            btnTempValuesUint.X = btnTempValues.Right ;
#endif
        }
        /// <summary>
@@ -1137,8 +1162,11 @@
#endif
            setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal;
#if __IOS__
            setTemp_UintButton.X = setTemp_ValuesButton.Right - Application.GetRealWidth(4);
#else
            setTemp_UintButton.X = setTemp_ValuesButton.Right + Application.GetRealWidth(4);
#endif
            double dd = 35;
            double.TryParse(function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "0"), out dd);
@@ -1151,7 +1179,10 @@
        /// </summary>
        private void updateFlow()
        {
            flow_ValuesButton.Text = "热水流量:" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min";
            if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.flow.ToString()) != null)
            {
                flow_ValuesButton.Text = "热水流量:" + function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) + "L/min";
            }
        }
        /// <summary>
@@ -1159,6 +1190,14 @@
        /// </summary>
        private void updateVolume()
        {
            if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.volume.ToString()) == null)
            {
                return;
            }
            if (function.attributes.Find((obj) => obj.key == WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()) == null)
            {
                return;
            }
            volumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString());
            recyclVolumeString = function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString());
            volume = 0;
@@ -1183,23 +1222,16 @@
        private void updateSocialContribution1()
        {
            socialContribution_Info1_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString());
#if __IOS__
            socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info1_ValuesButton.TextSize = 14;
#if __IOS__
                socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
#endif
                socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
                socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25);
            }
#if __IOS__
            socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right ;
            socialContribution_Info1_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2);
#endif
@@ -1210,23 +1242,15 @@
        private void updateSocialContribution2()
        {
            socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString());
#if __IOS__
            socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info2_ValuesButton.TextSize = 14;
#if __IOS__
                socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
#endif
                socialContribution_Info2_UintButton.Y = socialContribution_Info2_UintButton.Y - Application.GetRealWidth(4);
                socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
            }
#if __IOS__
            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right;
            socialContribution_Info2_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2);
#endif
@@ -1237,24 +1261,17 @@
        /// </summary>
        private void updateSocialContribution3()
        {
            socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString());
#if __IOS__
            socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info3_ValuesButton.TextSize = 14;
#if __IOS__
                socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
#endif
                socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
                //socialContribution_Info3_UintButton.Height = Application.GetRealWidth(23);
            }
#if __IOS__
            socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right;
            socialContribution_Info3_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2);
#endif