wxr
2024-09-10 8e940d7f0c873cfedf7f6d8c885be98b96f1d046
HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs
@@ -10,7 +10,7 @@
{
    public class InverterJinmaoPage : FrameLayout
    {
        FrameLayout bodyView;
        static InverterJinmaoPage bodyView;
        Function function;
        /// <summary>
        /// 今日发电量数据按钮
@@ -39,7 +39,7 @@
        /// <summary>
        /// 光伏运行状态图标按钮
        /// </summary>
        Button pvRunStatus_IconButtonp;
        Button pvRunStatus_IconButton;
        /// <summary>
        /// 光伏运行状态文本按钮
        /// </summary>
@@ -63,7 +63,7 @@
        /// <summary>
        /// 光伏状态今日用电量数据按钮
        /// </summary>
        Button loadElec_TodayTextButton;
        Button powerUsage_TodayValuesButton;
        /// <summary>
        /// 光伏状态本月用电量数据按钮
        /// </summary>
@@ -203,7 +203,7 @@
#if __IOS__
            pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft;
            pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(6);
            pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft;
            pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37);
@@ -213,12 +213,12 @@
            {
                Y = Application.GetRealWidth(43),
                Height = Application.GetRealWidth(17),
                Text = "kw",
                Text = "kwh",
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = 12,
                TextAlignment = TextAlignment.CenterLeft,
            };
            pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right;
            pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right - Application.GetRealWidth(2);
            electricityGenerationView.AddChidren(pvGenerate_todayUintButton);
            pvGenerate_TotalValuesButton = new Button()
@@ -276,7 +276,7 @@
            {
                Y = Application.GetRealWidth(43),
                Height = Application.GetRealWidth(17),
                Text = "kw",
                Text = "kwh",
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = 12,
                TextAlignment = TextAlignment.CenterRight,
@@ -377,7 +377,7 @@
            };
            pvEleGenerationInfoView.AddChidren(pvRunStatusInfoView);
            pvRunStatus_IconButtonp = new Button()
            pvRunStatus_IconButton = new Button()
            {
                X = Application.GetRealWidth(8 + 14),
                Gravity = Gravity.CenterVertical,
@@ -385,7 +385,7 @@
                Height = Application.GetRealWidth(12),
                UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png",
            };
            pvRunStatusInfoView.AddChidren(pvRunStatus_IconButtonp);
            pvRunStatusInfoView.AddChidren(pvRunStatus_IconButton);
            pvRunStatus_TextButton = new Button()
            {
@@ -417,20 +417,21 @@
                try
                {
                    int index = 1;
                    float pvPower = 0.00f;
                    while (index < 361)
                    {
                        if (function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()) == "0")
                        float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()), out pvPower);
                        if (pvPower > 0.00f)
                        {
                            continue;
                        }
                        Application.RunOnMainThread(() =>
                        {
                            powerGenerationBg.SetRotation(1f * index++);
                        });
                        System.Threading.Thread.Sleep(50);
                        if (index == 361)
                        {
                            index = 1;
                            Application.RunOnMainThread(() =>
                            {
                                powerGenerationBg.SetRotation(1f * index++);
                            });
                            System.Threading.Thread.Sleep(50);
                            if (index == 361)
                            {
                                index = 1;
                            }
                        }
                    }
                }
@@ -465,7 +466,7 @@
                Y = Application.GetRealWidth(78),
                //Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(25),
                Text = "实时发电功率 (kwh)",
                Text = "实时发电功率 (kw)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -494,7 +495,7 @@
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "今日发电量 (kw)",
                Text = "今日发电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -523,7 +524,7 @@
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "本月发电量 (kw)",
                Text = "本月发电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -552,7 +553,7 @@
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "本年发电量 (kw)",
                Text = "本年发电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -563,7 +564,7 @@
                try
                {
                    var revertObj = new HttpServerRequest().GetSensorHistory("custom_year",
                        function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), DateTime.Now.Year.ToString());
                        function.deviceId, InverterJinmao_AttrEnum.pv_electricity.ToString(), DateTime.Now.Year.ToString());
                    if (revertObj != null)
                    {
                        if (revertObj.Code == StateCode.SUCCESS)
@@ -643,20 +644,21 @@
                try
                {
                    int index = 1;
                    float loadPower = 0.00f;
                    while (index < 361)
                    {
                        if (function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()) == "0")
                        float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()), out loadPower);
                        if (loadPower > 0.00f)
                        {
                            continue;
                        }
                        Application.RunOnMainThread(() =>
                        {
                            powerUsageBg.SetRotation(1f * index++);
                        });
                        System.Threading.Thread.Sleep(50);
                        if (index == 361)
                        {
                            index = 1;
                            Application.RunOnMainThread(() =>
                            {
                                powerUsageBg.SetRotation(1f * index++);
                            });
                            System.Threading.Thread.Sleep(50);
                            if (index == 361)
                            {
                                index = 1;
                            }
                        }
                    }
                }
@@ -687,7 +689,7 @@
                Y = Application.GetRealWidth(78),
                //Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(25),
                Text = "实时用电功率 (kwh)",
                Text = "实时用电功率 (kw)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -695,7 +697,7 @@
            powerUsageView.AddChidren(powerUsage_TextButton);
            var powerUsage_TodayValuesButton = new Button()
            powerUsage_TodayValuesButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(191),
@@ -709,13 +711,13 @@
            };
            electricityUsageStatusView.AddChidren(powerUsage_TodayValuesButton);
            loadElec_TodayTextButton = new Button()
            var loadElec_TodayTextButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "今日用电量 (kw)",
                Text = "今日用电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -742,7 +744,7 @@
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "本月用电量 (kw)",
                Text = "本月用电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
@@ -770,189 +772,236 @@
                Y = Application.GetRealWidth(220),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(17),
                Text = "本年用电量 (kw)",
                Text = "本年用电量 (kwh)",
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
            };
            electricityUsageStatusView.AddChidren(powerUsage_YearTextButton);
            new System.Threading.Thread(() =>
            {
                try
                {
                    var revertObj = new HttpServerRequest().GetSensorHistory("custom_year",
                        function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), DateTime.Now.Year.ToString());
                    if (revertObj != null)
                    {
                        if (revertObj.Code == StateCode.SUCCESS)
                        {
                            var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString());
                            double totalValues = 0.0;
                            double values = 0.0;
                            foreach (var data in revertData)
                            {
                                double.TryParse(data.fieldValue, out values);
                                totalValues += values;
                            }
                            Application.RunOnMainThread(() =>
                            {
                                powerUsage_YearValuesButton.Text = totalValues.ToString();
                                while (true)
                                {
                                    if (powerUsage_YearValuesButton.Width < powerUsage_YearValuesButton.GetTextWidth())
                                    {
                                        powerUsage_YearValuesButton.TextSize--;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log("Error", "读取金茂本年发电量数据异常:" + ex.Message);
                }
            })
            { IsBackground = true }.Start();
            #endregion
            #endregion
            contentView.AddChidren(new Button()
            if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
            {
                Height = Application.GetRealWidth(8)
            });
                contentView.AddChidren(new Button()
                {
                    Height = Application.GetRealWidth(8)
                });
            #region 储能运行状态 Energy storage
            var esRunStatus_TitleButton = new Button()
            {
                X = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(47),
                TextAlignment = TextAlignment.CenterLeft,
                Text = "储能运行状态",
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 16,
                IsBold = true,
            };
            contentView.AddChidren(esRunStatus_TitleButton);
                #region 储能运行状态 Energy storage
                var esRunStatus_TitleButton = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(47),
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = "储能运行状态",
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = 16,
                    IsBold = true,
                };
                contentView.AddChidren(esRunStatus_TitleButton);
            #region
            var esStatusView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(194),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealHeight(12),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
            contentView.AddChidren(esStatusView);
                #region
                var esStatusView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealWidth(194),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealHeight(12),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 0,
                };
                contentView.AddChidren(esStatusView);
            esStatus_InfoView = new FrameLayout()
            {
                X = 0 - Application.GetRealWidth(14),
                Y = Application.GetRealWidth(12),
                Width = Application.GetRealWidth(68 + 14),
                Height = Application.GetRealWidth(28),
                BackgroundColor = 0x1500C22D,
                Radius = (uint)Application.GetRealHeight(14),
                BorderColor = 0x00FFFFFF,
                BorderWidth = 0,
            };
            esStatusView.AddChidren(esStatus_InfoView);
                esStatus_InfoView = new FrameLayout()
                {
                    X = 0 - Application.GetRealWidth(14),
                    Y = Application.GetRealWidth(12),
                    Width = Application.GetRealWidth(68 + 14),
                    Height = Application.GetRealWidth(28),
                    BackgroundColor = 0x1500C22D,
                    Radius = (uint)Application.GetRealHeight(14),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 0,
                };
                esStatusView.AddChidren(esStatus_InfoView);
            esRunStatus_Info_IconButton = new Button()
            {
                X = Application.GetRealWidth(8 + 14),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(12),
                Height = Application.GetRealWidth(12),
                UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png",
            };
            esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton);
                esRunStatus_Info_IconButton = new Button()
                {
                    X = Application.GetRealWidth(8 + 14),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(12),
                    Height = Application.GetRealWidth(12),
                    UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png",
                };
                esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton);
            esRunStatus_Info_TextButton = new Button()
            {
                X = Application.GetRealWidth(8 + 14 + 4 + 12),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                TextColor = 0xFF00C22D,
                Text = "充电",
            };
            esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton);
                esRunStatus_Info_TextButton = new Button()
                {
                    X = Application.GetRealWidth(8 + 14 + 4 + 12),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = 14,
                    TextColor = 0xFF00C22D,
                    Text = "充电",
                };
                esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton);
            esRunStatus_BatteryValuesButton = new Button()
            {
                Y = Application.GetRealWidth(18),
                Height = Application.GetRealWidth(17),
                TextAlignment = TextAlignment.CenterRight,
                Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%",
                TextSize = 12,
                TextColor = 0xFF00C22D,
            };
            esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8);
            esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width;
            esStatusView.AddChidren(esRunStatus_BatteryValuesButton);
                esRunStatus_BatteryValuesButton = new Button()
                {
                    Y = Application.GetRealWidth(18),
                    Height = Application.GetRealWidth(17),
                    TextAlignment = TextAlignment.CenterRight,
                    Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%",
                    TextSize = 12,
                    TextColor = 0xFF00C22D,
                };
                esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8);
                esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width;
                esStatusView.AddChidren(esRunStatus_BatteryValuesButton);
            esRunStatus_BatteryIconButton = new Button()
            {
                X = Application.GetRealWidth(343 - 12 - 20) - esRunStatus_BatteryValuesButton.Width,
                Y = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(20),
                Height = Application.GetRealWidth(20),
                UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png",
                SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png",
                IsSelected = esRunStatus_BatteryValuesButton.Text == "100%"
            };
            esStatusView.AddChidren(esRunStatus_BatteryIconButton);
                esRunStatus_BatteryIconButton = new Button()
                {
                    X = Application.GetRealWidth(343 - 12 - 20) - esRunStatus_BatteryValuesButton.Width,
                    Y = Application.GetRealWidth(16),
                    Width = Application.GetRealWidth(20),
                    Height = Application.GetRealWidth(20),
                    UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png",
                    SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png",
                    IsSelected = esRunStatus_BatteryValuesButton.Text == "100%"
                };
                esStatusView.AddChidren(esRunStatus_BatteryIconButton);
            var esRunStatus_ValuesInfoView = new FrameLayout()
            {
                Width = Application.GetRealWidth(282),
                Height = Application.GetRealWidth(153),
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealWidth(40),
                BackgroundImagePath = "FunctionIcon/Acst/Inverter/EnergyStorageStatusBg.png",
            };
            esStatusView.AddChidren(esRunStatus_ValuesInfoView);
                var esRunStatus_ValuesInfoView = new FrameLayout()
                {
                    Width = Application.GetRealWidth(282),
                    Height = Application.GetRealWidth(153),
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealWidth(40),
                    BackgroundImagePath = "FunctionIcon/Acst/Inverter/EnergyStorageStatusBg.png",
                };
                esStatusView.AddChidren(esRunStatus_ValuesInfoView);
            #region 实时充电功率
            var esRunStatus_ChargeValuesView = new FrameLayout()
            {
                X = Application.GetRealWidth(15),
                Width = Application.GetRealWidth(128),
                Height = Application.GetRealWidth(128),
            };
            esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView);
                #region 实时充电功率
                var esRunStatus_ChargeValuesView = new FrameLayout()
                {
                    X = Application.GetRealWidth(15),
                    Width = Application.GetRealWidth(128),
                    Height = Application.GetRealWidth(128),
                };
                esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView);
            esRunStatus_ChargeValuesButton = new Button()
            {
                Y = Application.GetRealWidth(36),
                Height = Application.GetRealWidth(32),
                TextAlignment = TextAlignment.Center,
                Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 24,
                IsBold = true,
            };
            esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeValuesButton);
                esRunStatus_ChargeValuesButton = new Button()
                {
                    Y = Application.GetRealWidth(36),
                    Height = Application.GetRealWidth(32),
                    TextAlignment = TextAlignment.Center,
                    Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = 24,
                    IsBold = true,
                };
                esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeValuesButton);
            var esRunStatus_ChargeTextButton = new Button()
            {
                X = Application.GetRealWidth(1),
                Y = Application.GetRealWidth(76),
                Height = Application.GetRealWidth(17),
                TextAlignment = TextAlignment.Center,
                Text = "实时充电功率(kwh)",
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
            };
            esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton);
            #endregion
                var esRunStatus_ChargeTextButton = new Button()
                {
                    X = Application.GetRealWidth(1),
                    Y = Application.GetRealWidth(76),
                    Height = Application.GetRealWidth(17),
                    TextAlignment = TextAlignment.Center,
                    Text = "实时充电功率(kw)",
                    TextColor = CSS_Color.TextualColor,
                    TextSize = 12,
                };
                esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton);
                #endregion
            #region 实时用电功率
            var esRunStatus_DischargeValuesView = new FrameLayout()
            {
                X = Application.GetRealWidth(132+13),
                Width = Application.GetRealWidth(128),
                Height = Application.GetRealWidth(128),
            };
            esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView);
                #region 实时用电功率
                var esRunStatus_DischargeValuesView = new FrameLayout()
                {
                    X = Application.GetRealWidth(132 + 13),
                    Width = Application.GetRealWidth(128),
                    Height = Application.GetRealWidth(128),
                };
                esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView);
            esRunStatus_DischargeValuesButton = new Button()
            {
                Y = Application.GetRealWidth(36),
                Height = Application.GetRealWidth(32),
                TextAlignment = TextAlignment.Center,
                Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 24,
                IsBold = true,
            };
            esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeValuesButton);
                esRunStatus_DischargeValuesButton = new Button()
                {
                    Y = Application.GetRealWidth(36),
                    Height = Application.GetRealWidth(32),
                    TextAlignment = TextAlignment.Center,
                    Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = 24,
                    IsBold = true,
                };
                esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeValuesButton);
            var esRunStatus_DischargeTextButton = new Button()
            {
                X = Application.GetRealWidth(1),
                Y = Application.GetRealWidth(76),
                Height = Application.GetRealWidth(17),
                TextAlignment = TextAlignment.Center,
                Text = "实时放电功率(kwh)",
                TextColor = CSS_Color.TextualColor,
                TextSize = 12,
            };
            esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeTextButton);
            #endregion
                var esRunStatus_DischargeTextButton = new Button()
                {
                    X = Application.GetRealWidth(1),
                    Y = Application.GetRealWidth(76),
                    Height = Application.GetRealWidth(17),
                    TextAlignment = TextAlignment.Center,
                    Text = "实时放电功率(kwh)",
                    TextColor = CSS_Color.TextualColor,
                    TextSize = 12,
                };
                esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeTextButton);
                #endregion
                #endregion
                #endregion
            #endregion
            #endregion
            }
            contentView.AddChidren(new Button()
            {
@@ -1026,6 +1075,9 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.BottomLeft,
            };
#if __IOS__
            socialContribution_Info1_UintButton.Y = Application.GetRealWidth(66);
#endif
            socialContribution_InfoView_1.AddChidren(socialContribution_Info1_UintButton);
            var socialContribution_Info1_TipButton = new Button()
@@ -1092,6 +1144,9 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.BottomLeft,
            };
#if __IOS__
            socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66);
#endif
            socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton);
            var socialContribution_Info2_TipButton = new Button()
@@ -1158,6 +1213,9 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.BottomLeft,
            };
            #if __IOS__
            socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66);
            #endif
            socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton);
            var socialContribution_Info3_TipButton = new Button()
@@ -1184,7 +1242,7 @@
        /// 更新界面数据
        /// </summary>
        /// <param name="temp"></param>
        public void UpdateStatus(Function temp)
        public static void UpdateStatus(Function temp)
        {
            if (bodyView == null)
            {
@@ -1195,38 +1253,38 @@
                try
                {
                    /// 更新今日发电量
                    upatePvGenerateTodayValues();
                    bodyView.upatePvGenerateTodayValues();
                    /// 更新累计发电量
                    upatePvGenerateTotalValues();
                    bodyView.upatePvGenerateTotalValues();
                    /// 更新今日用电量
                    upatePvLoadTodayValues();
                    bodyView.upatePvLoadTodayValues();
                    /// 更新累计用电量
                    upatePvLoadTotalValues();
                    bodyView.upatePvLoadTotalValues();
                    /// 更新光伏运行状态
                    upatePvRunStatus();
                    bodyView.upatePvRunStatus();
                    /// 更新光伏发电功率
                    updatePvPower();
                    bodyView.updatePvPower();
                    /// 更新光伏本月发电量
                    upatePvGenerateMonthValues();
                    bodyView.upatePvGenerateMonthValues();
                    /// 更新光伏用电功率
                    updateLoadElec();
                    bodyView.updateLoadElec();
                    ///更新光伏状态本月用电量
                    updateLoadElecMonthValues();
                    bodyView.updateLoadElecMonthValues();
                    //更新储能运行状态
                    updateEsRunStates();
                    bodyView.updateEsRunStates();
                    //更新储能电池百分比
                    updateEsBatterySoc();
                    bodyView.updateEsBatterySoc();
                    //更新储能实时充电状态
                    updateEsCharge();
                    bodyView.updateEsCharge();
                    //更新储能实时放电状态
                    updateEsDischarge();
                    updateSocialContribution1();
                    updateSocialContribution2();
                    updateSocialContribution3();
                    bodyView.updateEsDischarge();
                    bodyView.updateSocialContribution1();
                    bodyView.updateSocialContribution2();
                    bodyView.updateSocialContribution3();
                }
                catch (Exception ex)
                {
                    MainPage.Log("Error", $"金茂光伏更新异常:{ex.Message}");
                    MainPage.Log("Error", $"金茂光伏更新异常:{ex.StackTrace}");
                }
            });
        }
@@ -1251,14 +1309,14 @@
        /// </summary>
        private void upatePvGenerateTotalValues()
        {
            pvGenerate_TodayValuesButton.Text = "累计发电量:" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString());
            pvGenerate_TotalValuesButton.Text = "累计发电量:" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString());
        }
        /// <summary>
        /// 更新今日用电量
        /// </summary>
        private void upatePvLoadTodayValues()
        {
            pvLoad_TodayValuesButton.Text = loadElec_TodayTextButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString());
            pvLoad_TodayValuesButton.Text = powerUsage_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString());
        }
        /// <summary>
        /// 更新本月用电量
@@ -1284,19 +1342,19 @@
            {
                case "run":
                    pvRunStatusInfoView.BackgroundColor = 0x154484F4;
                    pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png";
                    pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png";
                    pvRunStatus_TextButton.Text = "运行";
                    pvRunStatus_TextButton.TextColor = 0xFF4484F4;
                    break;
                case "fault":
                    pvRunStatusInfoView.BackgroundColor = 0x15FF4747;
                    pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconFault.png";
                    pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconFault.png";
                    pvRunStatus_TextButton.Text = "故障";
                    pvRunStatus_TextButton.TextColor = 0xFFFF4747;
                    break;
                case "standby":
                    pvRunStatusInfoView.BackgroundColor = 0x15798394;
                    pvRunStatus_IconButtonp.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconStandby.png";
                    pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconStandby.png";
                    pvRunStatus_TextButton.Text = "待机";
                    pvRunStatus_TextButton.TextColor = 0xFF798394;
                    break;
@@ -1322,40 +1380,43 @@
        /// </summary>
        private void updateEsRunStates()
        {
            switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString()))
            if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
            {
                case "charge":
                    esStatus_InfoView.BackgroundColor = 0x1500C22D;
                    esRunStatus_BatteryValuesButton.TextColor = 0xFF00C22D;
                    esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png";
                    esRunStatus_Info_TextButton.Text = "充电";
                    esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png";
                    esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png";
                    break;
                case "discharge":
                    esStatus_InfoView.BackgroundColor = 0x15FC9C04;
                    esRunStatus_BatteryValuesButton.TextColor = 0xFFFC9C04;
                    esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconDischarge.png";
                    esRunStatus_Info_TextButton.Text = "放电";
                    esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg.png";
                    esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg100.png";
                    break;
                case "shutdown":
                    esStatus_InfoView.BackgroundColor = 0x15798394;
                    esRunStatus_BatteryValuesButton.TextColor = 0xFF798394;
                    esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconShutdown.png";
                    esRunStatus_Info_TextButton.Text = "停机";
                    esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown.png";
                    esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown100.png";
                    break;
                case "fault":
                    esStatus_InfoView.BackgroundColor = 0x15FF4747;
                    esRunStatus_BatteryValuesButton.TextColor = 0xFFFF4747;
                    esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconFault.png";
                    esRunStatus_Info_TextButton.Text = "故障";
                    esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault.png";
                    esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault100.png";
                    break;
                switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString()))
                {
                    case "charge":
                        esStatus_InfoView.BackgroundColor = 0x1500C22D;
                        esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF00C22D;
                        esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png";
                        esRunStatus_Info_TextButton.Text = "充电";
                        esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png";
                        esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png";
                        break;
                    case "discharge":
                        esStatus_InfoView.BackgroundColor = 0x15FC9C04;
                        esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFC9C04;
                        esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconDischarge.png";
                        esRunStatus_Info_TextButton.Text = "放电";
                        esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg.png";
                        esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg100.png";
                        break;
                    case "shutdown":
                        esStatus_InfoView.BackgroundColor = 0x15798394;
                        esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF798394;
                        esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconShutdown.png";
                        esRunStatus_Info_TextButton.Text = "停机";
                        esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown.png";
                        esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown100.png";
                        break;
                    case "fault":
                        esStatus_InfoView.BackgroundColor = 0x15FF4747;
                        esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFF4747;
                        esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconFault.png";
                        esRunStatus_Info_TextButton.Text = "故障";
                        esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault.png";
                        esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault100.png";
                        break;
                }
            }
        }
        /// <summary>
@@ -1363,10 +1424,13 @@
        /// </summary>
        private void updateEsBatterySoc()
        {
            esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%";
            if(esRunStatus_BatteryIconButton.Text == "100%")
            if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
            {
                esRunStatus_BatteryIconButton.IsSelected = true;
                esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%";
                if (esRunStatus_BatteryIconButton.Text == "100%")
                {
                    esRunStatus_BatteryIconButton.IsSelected = true;
                }
            }
        }
        /// <summary>
@@ -1374,51 +1438,59 @@
        /// </summary>
        private void updateEsCharge()
        {
            esRunStatus_ChargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString());
            if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
            {
                esRunStatus_ChargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString());
            }
        }
        /// <summary>
        /// 更新储能实时放电状态
        /// </summary>
        private void updateEsDischarge()
        {
            esRunStatus_DischargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString());
            if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
            {
                esRunStatus_DischargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString());
            }
        }
        /// <summary>
        /// 更新社会贡献1数据UI
        /// </summary>
        private void updateSocialContribution1()
        {
            socialContribution_Info1_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.coal.ToString());
#if __IOS__
            socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info1_ValuesButton.TextSize = socialContribution_Info1_ValuesButton.TextSize - 4;
                socialContribution_Info1_ValuesButton.TextSize = 14;
                socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
                socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25);
            }
#if __IOS__
            socialContribution_Info1_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2);
#endif
        }
        /// <summary>
        /// 更新社会贡2献数据UI
        /// </summary>
        private void updateSocialContribution2()
        {
            socialContribution_Info2_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.co2.ToString());
#if __IOS__
            socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString());
            socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info2_UintButton.Width > Application.GetRealWidth(61))
            if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info2_UintButton.TextSize = socialContribution_Info2_UintButton.TextSize - 4;
                socialContribution_Info2_ValuesButton.TextSize = 14;
                socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
            }
#if __IOS__
            socialContribution_Info2_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2);
#endif
        }
        /// <summary>
@@ -1426,18 +1498,20 @@
        /// </summary>
        private void updateSocialContribution3()
        {
            socialContribution_Info3_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.trees.ToString());
#if __IOS__
            socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
            socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString());
            socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
#endif
            if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61))
            {
                socialContribution_Info3_ValuesButton.TextSize = socialContribution_Info3_ValuesButton.TextSize - 4;
                socialContribution_Info3_ValuesButton.TextSize = 14;
                socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
                socialContribution_Info3_UintButton.Height = Application.GetRealWidth(25);
            }
#if __IOS__
            socialContribution_Info3_ValuesButton.Width += Application.GetRealWidth(6);
            socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4);
#else
            socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2);
#endif
        }
    }
}