From eeb6f0b4bf0a81834325638401d5fa404e53db93 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期四, 05 九月 2024 19:41:45 +0800
Subject: [PATCH] 金茂光伏储能,热水器;自动化,空调,地暖步进判断

---
 HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs |  438 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 365 insertions(+), 73 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs
index 382e769..5345a30 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs
@@ -1,4 +1,7 @@
 锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DAL.Server;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
@@ -54,9 +57,64 @@
         /// </summary>
         Button pvGeneration_MonthValuesButton;
         /// <summary>
-        /// 鍏変紡鏈勾鍙戠數閲忔暟鎹寜閽�
+        /// 鍏変紡瀹炴椂鐢ㄧ數鍔熺巼鏁版嵁鎸夐挳
         /// </summary>
-        Button pvGeneration_YearValuesButton;
+        Button loadElec_ValuesButton;
+        /// <summary>
+        /// 鍏変紡鐘舵�佷粖鏃ョ敤鐢甸噺鏁版嵁鎸夐挳
+        /// </summary>
+        Button loadElec_TodayTextButton;
+        /// <summary>
+        /// 鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺鏁版嵁鎸夐挳
+        /// </summary>
+        Button loadElec_MonthValuesButton;
+        /// <summary>
+        /// 鍌ㄨ兘杩愯鐘舵�佷俊鎭尯鍩�
+        /// </summary>
+        FrameLayout esStatus_InfoView;
+        /// <summary>
+        /// 鍌ㄨ兘杩愯鐘舵�佸浘鏍囨寜閽�
+        /// </summary>
+        Button esRunStatus_Info_IconButton;
+        /// <summary>
+        /// 鍌ㄨ兘杩愯鐘舵�佹枃鏈寜閽�
+        /// </summary>
+        Button esRunStatus_Info_TextButton;
+        /// <summary>
+        /// 鍌ㄨ兘鐢垫睜鐘舵�佸浘鏍囨寜閽�
+        /// </summary>
+        Button esRunStatus_BatteryIconButton;
+        /// <summary>
+        /// 鍌ㄨ兘鐢垫睜鐘舵�佺櫨鍒嗘瘮鎸夐挳
+        /// </summary>
+        Button esRunStatus_BatteryValuesButton;
+        /// <summary>
+        /// 鍌ㄨ兘瀹炴椂鍏呯數鍔熺巼
+        /// </summary>
+        Button esRunStatus_ChargeValuesButton;
+        /// <summary>
+        /// 鍌ㄨ兘瀹炴椂鏀剧數鍔熺巼
+        /// </summary>
+        Button esRunStatus_DischargeValuesButton;
+
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info1_ValuesButton;
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info1_UintButton;
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info2_ValuesButton;
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info2_UintButton;
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info3_UintButton;
+        /// <summary>
+        /// </summary>
+        Button socialContribution_Info3_ValuesButton;
 
 
         public InverterJinmaoPage()
@@ -145,7 +203,7 @@
 
 #if __IOS__
             pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft;
-            pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4);
+            pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(6);
 #else
             pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft;
             pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37);
@@ -345,9 +403,44 @@
                 Y = Application.GetRealWidth(20),
                 Width = Application.GetRealWidth(151),
                 Height = Application.GetRealWidth(151),
-                BackgroundImagePath = "FunctionIcon/Acst/Inverter/PvBgRun.png"
             };
             pvEleGenerationInfoView.AddChidren(powerGenerationView);
+
+            var powerGenerationBg = new Button()
+            {
+                UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgRun.png"
+            };
+            powerGenerationView.AddChidren(powerGenerationBg);
+
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    int index = 1;
+                    while (index < 361)
+                    {
+                        if (function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()) == "0")
+                        {
+                            continue;
+                        }
+                        Application.RunOnMainThread(() =>
+                        {
+                            powerGenerationBg.SetRotation(1f * index++);
+                        });
+                        System.Threading.Thread.Sleep(50);
+                        if (index == 361)
+                        {
+                            index = 1;
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log("Error", $"閲戣寕UI鎺т欢鏃嬭浆寮傚父:{ex.Message}");
+                }
+            })
+            { IsBackground = true }.Start();
+
             #endregion
 
             #region 鍏変紡鍙戠數閲�
@@ -439,13 +532,13 @@
             #endregion
 
             #region 鍏変紡鏈勾鍙戠數閲�
-            pvGeneration_YearValuesButton = new Button()
+            var pvGeneration_YearValuesButton = new Button()
             {
                 X = Application.GetRealWidth(16 + 212),
                 Y = Application.GetRealWidth(191),
                 Width = Application.GetRealWidth(100),
                 Height = Application.GetRealWidth(24),
-                Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()),
+                Text = "---",
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = 18,
@@ -459,13 +552,57 @@
                 Y = Application.GetRealWidth(220),
                 Width = Application.GetRealWidth(100),
                 Height = Application.GetRealWidth(17),
-                Text = "绱鍙戠數閲� (kw)",
+                Text = "鏈勾鍙戠數閲� (kw)",
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.TextualColor,
                 TextSize = 12,
             };
             pvEleGenerationInfoView.AddChidren(powerGeneration_YearTextButton);
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    var revertObj = new HttpServerRequest().GetSensorHistory("custom_year",
+                        function.deviceId, InverterJinmao_AttrEnum.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(() =>
+                            {
+                                pvGeneration_YearValuesButton.Text = totalValues.ToString();
+                                while (true)
+                                {
+                                    if (pvGeneration_YearValuesButton.Width < pvGeneration_YearValuesButton.GetTextWidth())
+                                    {
+                                        pvGeneration_YearValuesButton.TextSize--;
+                                    }
+                                    else
+                                    {
+                                        break;
+                                    }
+                                }
+                            });
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log("Error", "璇诲彇閲戣寕鏈勾鍙戠數閲忔暟鎹紓甯革細" + ex.Message);
+                }
+            })
+            { IsBackground = true }.Start();
+
             #endregion
+           
             #endregion
 
             contentView.AddChidren(new Button()
@@ -492,11 +629,45 @@
                 Y = Application.GetRealWidth(20),
                 Width = Application.GetRealWidth(151),
                 Height = Application.GetRealWidth(151),
-                BackgroundImagePath = "FunctionIcon/Acst/Inverter/PvBgDischarge.png"
             };
             electricityUsageStatusView.AddChidren(powerUsageView);
 
-            var powerUsage_ValuesButton = new Button()
+            var powerUsageBg = new Button()
+            {
+                UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgDischarge.png"
+            };
+            powerUsageView.AddChidren(powerUsageBg);
+
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    int index = 1;
+                    while (index < 361)
+                    {
+                        if (function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()) == "0")
+                        {
+                            continue;
+                        }
+                        Application.RunOnMainThread(() =>
+                        {
+                            powerUsageBg.SetRotation(1f * index++);
+                        });
+                        System.Threading.Thread.Sleep(50);
+                        if (index == 361)
+                        {
+                            index = 1;
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log("Error", $"閲戣寕UI鎺т欢鏃嬭浆寮傚父2:{ex.Message}");
+                }
+            })
+            { IsBackground = true }.Start();
+
+            loadElec_ValuesButton = new Button()
             {
                 Gravity = Gravity.CenterHorizontal,
                 Y = Application.GetRealWidth(46),
@@ -508,7 +679,7 @@
                 TextSize = 24,
                 IsBold = true,
             };
-            powerUsageView.AddChidren(powerUsage_ValuesButton);
+            powerUsageView.AddChidren(loadElec_ValuesButton);
 
             var powerUsage_TextButton = new Button()
             {
@@ -538,7 +709,7 @@
             };
             electricityUsageStatusView.AddChidren(powerUsage_TodayValuesButton);
 
-            var powerUsage_TodayTextButton = new Button()
+            loadElec_TodayTextButton = new Button()
             {
                 X = Application.GetRealWidth(16),
                 Y = Application.GetRealWidth(220),
@@ -549,10 +720,9 @@
                 TextColor = CSS_Color.TextualColor,
                 TextSize = 12,
             };
-            electricityUsageStatusView.AddChidren(powerUsage_TodayTextButton);
+            electricityUsageStatusView.AddChidren(loadElec_TodayTextButton);
 
-
-            var powerUsage_MonthValuesButton = new Button()
+            loadElec_MonthValuesButton = new Button()
             {
                 X = Application.GetRealWidth(16 + 105),
                 Y = Application.GetRealWidth(191),
@@ -564,7 +734,7 @@
                 TextSize = 18,
                 IsBold = true,
             };
-            electricityUsageStatusView.AddChidren(powerUsage_MonthValuesButton);
+            electricityUsageStatusView.AddChidren(loadElec_MonthValuesButton);
 
             var powerUsage_MonthTextButton = new Button()
             {
@@ -642,7 +812,7 @@
             };
             contentView.AddChidren(esStatusView);
 
-            var esStatus_InfoView = new FrameLayout()
+            esStatus_InfoView = new FrameLayout()
             {
                 X = 0 - Application.GetRealWidth(14),
                 Y = Application.GetRealWidth(12),
@@ -655,7 +825,7 @@
             };
             esStatusView.AddChidren(esStatus_InfoView);
 
-            var esRunStatus_Info_IconButton = new Button()
+            esRunStatus_Info_IconButton = new Button()
             {
                 X = Application.GetRealWidth(8 + 14),
                 Gravity = Gravity.CenterVertical,
@@ -665,7 +835,7 @@
             };
             esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton);
 
-            var esRunStatus_Info_TextButton = new Button()
+            esRunStatus_Info_TextButton = new Button()
             {
                 X = Application.GetRealWidth(8 + 14 + 4 + 12),
                 TextAlignment = TextAlignment.CenterLeft,
@@ -675,7 +845,7 @@
             };
             esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton);
 
-            var esRunStatus_BatteryValuesButton = new Button()
+            esRunStatus_BatteryValuesButton = new Button()
             {
                 Y = Application.GetRealWidth(18),
                 Height = Application.GetRealWidth(17),
@@ -684,21 +854,19 @@
                 TextSize = 12,
                 TextColor = 0xFF00C22D,
             };
-#if __IOS__
             esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8);
-#else
-            esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth();
-#endif
             esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width;
             esStatusView.AddChidren(esRunStatus_BatteryValuesButton);
 
-            var esRunStatus_BatteryIconButton = new Button()
+            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);
 
@@ -721,7 +889,7 @@
             };
             esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView);
 
-            var esRunStatus_ChargeValuesButton = new Button()
+            esRunStatus_ChargeValuesButton = new Button()
             {
                 Y = Application.GetRealWidth(36),
                 Height = Application.GetRealWidth(32),
@@ -746,7 +914,7 @@
             esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton);
             #endregion
 
-            #region 瀹炴椂鏀剧數鍔熺巼
+            #region 瀹炴椂鐢ㄧ數鍔熺巼
             var esRunStatus_DischargeValuesView = new FrameLayout()
             {
                 X = Application.GetRealWidth(132+13),
@@ -755,7 +923,7 @@
             };
             esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView);
 
-            var esRunStatus_DischargeValuesButton = new Button()
+            esRunStatus_DischargeValuesButton = new Button()
             {
                 Y = Application.GetRealWidth(36),
                 Height = Application.GetRealWidth(32),
@@ -832,7 +1000,7 @@
             };
             socialContribution_InfoView_1.AddChidren(socialContribution_Info1_IconButton);
 
-            var socialContribution_Info1_ValuesButton = new Button()
+            socialContribution_Info1_ValuesButton = new Button()
             {
                 X = Application.GetRealWidth(12),
                 Y = Application.GetRealWidth(68),
@@ -847,7 +1015,7 @@
             socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
             socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton);
 
-            var socialContribution_Info1_UintButton = new Button()
+            socialContribution_Info1_UintButton = new Button()
             {
                 X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4),
                 Y = Application.GetRealWidth(68),
@@ -898,7 +1066,7 @@
             };
             socialContribution_InfoView_2.AddChidren(socialContribution_Info2_IconButton);
 
-            var socialContribution_Info2_ValuesButton = new Button()
+            socialContribution_Info2_ValuesButton = new Button()
             {
                 X = Application.GetRealWidth(12),
                 Y = Application.GetRealWidth(68),
@@ -913,7 +1081,7 @@
             socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
             socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton);
 
-            var socialContribution_Info2_UintButton = new Button()
+            socialContribution_Info2_UintButton = new Button()
             {
                 X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4),
                 Y = Application.GetRealWidth(68),
@@ -964,7 +1132,7 @@
             };
             socialContribution_InfoView_3.AddChidren(socialContribution_Info3_IconButton);
 
-            var socialContribution_Info3_ValuesButton = new Button()
+            socialContribution_Info3_ValuesButton = new Button()
             {
                 X = Application.GetRealWidth(12),
                 Y = Application.GetRealWidth(68),
@@ -979,7 +1147,7 @@
             socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
             socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton);
 
-            var socialContribution_Info3_UintButton = new Button()
+            socialContribution_Info3_UintButton = new Button()
             {
                 X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4),
                 Y = Application.GetRealWidth(68),
@@ -1010,7 +1178,7 @@
 
             #endregion
 
-
+            Control.Ins.SendReadCommand(function);
         }
         /// <summary>
         /// 鏇存柊鐣岄潰鏁版嵁
@@ -1024,45 +1192,41 @@
             }
             Application.RunOnMainThread(() =>
             {
-                /// 鏇存柊浠婃棩鍙戠數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()))
+                try
                 {
+                    /// 鏇存柊浠婃棩鍙戠數閲�
                     upatePvGenerateTodayValues();
-                }
-                /// 鏇存柊绱鍙戠數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()))
-                {
+                    /// 鏇存柊绱鍙戠數閲�
                     upatePvGenerateTotalValues();
-                }
-                /// 鏇存柊浠婃棩鐢ㄧ數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()))
-                {
+                    /// 鏇存柊浠婃棩鐢ㄧ數閲�
                     upatePvLoadTodayValues();
-                }
-                /// 鏇存柊绱鐢ㄧ數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString()))
-                {
+                    /// 鏇存柊绱鐢ㄧ數閲�
                     upatePvLoadTotalValues();
-                }
-                /// 鏇存柊鍏変紡杩愯鐘舵��
-                if (function.GetAttrState(InverterJinmao_AttrEnum.system_status.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.system_status.ToString()))
-                {
+                    /// 鏇存柊鍏変紡杩愯鐘舵��
                     upatePvRunStatus();
-                }
-                /// 鏇存柊鍏変紡鍙戠數鍔熻兘
-                if (function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()))
-                {
-                    upatePvPower();
-                }
-                /// 鏇存柊鍏変紡鏈湀鍙戠數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString()))
-                {
+                    /// 鏇存柊鍏変紡鍙戠數鍔熺巼
+                    updatePvPower();
+                    /// 鏇存柊鍏変紡鏈湀鍙戠數閲�
                     upatePvGenerateMonthValues();
+                    /// 鏇存柊鍏変紡鐢ㄧ數鍔熺巼
+                    updateLoadElec();
+                    ///鏇存柊鍏変紡鐘舵�佹湰鏈堢敤鐢甸噺
+                    updateLoadElecMonthValues();
+                    //鏇存柊鍌ㄨ兘杩愯鐘舵��
+                    updateEsRunStates();
+                    //鏇存柊鍌ㄨ兘鐢垫睜鐧惧垎姣�
+                    updateEsBatterySoc();
+                    //鏇存柊鍌ㄨ兘瀹炴椂鍏呯數鐘舵��
+                    updateEsCharge();
+                    //鏇存柊鍌ㄨ兘瀹炴椂鏀剧數鐘舵��
+                    updateEsDischarge();
+                    updateSocialContribution1();
+                    updateSocialContribution2();
+                    updateSocialContribution3();
                 }
-                /// 鏇存柊鍏変紡鏈勾鍙戠數閲�
-                if (function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()) != temp.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()))
+                catch (Exception ex)
                 {
-                    upatePvGenerateYearValues();
+                    MainPage.Log("Error", $"閲戣寕鍏変紡鏇存柊寮傚父:{ex.Message}");
                 }
             });
         }
@@ -1083,13 +1247,6 @@
             pvGeneration_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString());
         }
         /// <summary>
-        /// 鏇存柊鍏変紡鏈勾鍙戠數閲�
-        /// </summary>
-        private void upatePvGenerateYearValues()
-        {
-            pvGeneration_YearValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString());
-        }
-        /// <summary>
         /// 鏇存柊绱鍙戠數閲�
         /// </summary>
         private void upatePvGenerateTotalValues()
@@ -1101,7 +1258,14 @@
         /// </summary>
         private void upatePvLoadTodayValues()
         {
-            pvLoad_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString());
+            pvLoad_TodayValuesButton.Text = loadElec_TodayTextButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString());
+        }
+        /// <summary>
+        /// 鏇存柊鏈湀鐢ㄧ數閲�
+        /// </summary>
+        private void updateLoadElecMonthValues()
+        {
+            loadElec_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_month.ToString());
         }
         /// <summary>
         /// 鏇存柊绱鐢ㄧ數閲�
@@ -1142,11 +1306,139 @@
         /// <summary>
         /// 鏇存柊鍏変紡鍙戠數鍔熺巼
         /// </summary>
-        private void upatePvPower()
+        private void updatePvPower()
         {
             pvPower_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString());
         }
+        /// <summary>
+        /// 鏇存柊鍏変紡鐢ㄧ數鍔熺巼
+        /// </summary>
+        private void updateLoadElec()
+        {
+            loadElec_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString());
+        }
+        /// <summary>
+        /// 鏇存柊鍌ㄨ兘杩愯鐘舵��
+        /// </summary>
+        private void updateEsRunStates()
+        {
+            switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString()))
+            {
+                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;
+            }
+        }
+        /// <summary>
+        /// 鏇存柊鍌ㄨ兘鐢垫睜鐧惧垎姣旂姸鎬�
+        /// </summary>
+        private void updateEsBatterySoc()
+        {
+            esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%";
+            if(esRunStatus_BatteryIconButton.Text == "100%")
+            {
+                esRunStatus_BatteryIconButton.IsSelected = true;
+            }
+        }
+        /// <summary>
+        /// 鏇存柊鍌ㄨ兘瀹炴椂鍏呯數鐘舵��
+        /// </summary>
+        private void updateEsCharge()
+        {
+            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());
+        }
 
+        /// <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_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4);
+        }
+        /// <summary>
+        /// 鏇存柊绀句細璐�2鐚暟鎹甎I
+        /// </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.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
+#endif
+            if (socialContribution_Info2_UintButton.Width > Application.GetRealWidth(61))
+            {
+                socialContribution_Info2_UintButton.TextSize = socialContribution_Info2_UintButton.TextSize - 4;
+            }
+
+            socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4);
+
+        }
+        /// <summary>
+        /// 鏇存柊绀句細璐�3鐚暟鎹甎I
+        /// </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.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_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4);
+        }
     }
 }
 

--
Gitblit v1.8.0