wxr
2022-10-18 6692d867a0876b014be3cbd64bc3a237a026dc2d
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -1186,20 +1186,34 @@
                    Text = "/" + FunctionList.List.InverterList().Count,
                };
                inverterListView.AddChidren(btnFunctionCount);
                int count = 0;
                foreach (var temp in FunctionList.List.InverterList())
                {
                    if (temp.online)
                    {
                        if (temp.trait_on_off.state.ToString() == "on")
                        {
                            ++count;
                        }
                    }
                }
                Button btnOpenCount = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnName.Bottom,
                    Width = Application.GetRealWidth(14 * FunctionList.List.InverterList().Count.ToString().Length),
                    Width = Application.GetRealWidth(14 * count.ToString().Length),
                    Height = Application.GetRealHeight(24),
                    TextColor = CSS_Color.MainColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = FunctionList.List.InverterList().FindAll((temp)=>temp.trait_on_off.curValue.ToString() == "on").Count.ToString(),
                    Text = count.ToString(),
                    Tag = "inverter_onCount",
                    BorderWidth = 0,
                };
                inverterListView.AddChidren(btnOpenCount);
                //Button btnWorkStatus = new Button()
                //{
@@ -1213,12 +1227,23 @@
                //};
                //inverterListView.AddChidren(btnWorkStatus);
                Button btnWorkingMode = new Button()
                Button btnWorkingModeIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnOpenCount.Bottom + Application.GetRealHeight(5),
                    Width = Application.GetRealWidth(14),
                    Height = Application.GetRealWidth(14),
                    UnSelectedImagePath = "FunctionIcon/Inverter/Icon1.png"
                };
                inverterListView.AddChidren(btnWorkingModeIcon);
                Button btnWorkingMode = new Button()
                {
                    X = Application.GetRealWidth(37),
                    Y = btnOpenCount.Bottom + Application.GetRealHeight(5),// + Application.GetRealHeight(16),
                    Width = Application.GetRealWidth(148),
                    Height = Application.GetRealHeight(18),
                    Height = Application.GetRealHeight(14),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextID = StringId.WorkingMode,
@@ -1226,12 +1251,23 @@
                };
                inverterListView.AddChidren(btnWorkingMode);
                Button btnPowerTenerationToday = new Button()
                Button btnPowerTenerationTodayIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnWorkingMode.Bottom + Application.GetRealHeight(5),
                    Y = btnWorkingMode.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(14),
                    Height = Application.GetRealWidth(14),
                    UnSelectedImagePath = "FunctionIcon/Inverter/Icon2.png"
                };
                inverterListView.AddChidren(btnPowerTenerationTodayIcon);
                Button btnPowerTenerationToday = new Button()
                {
                    X = Application.GetRealWidth(37),
                    Y = btnWorkingMode.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(148),
                    Height = Application.GetRealHeight(21),
                    Height = Application.GetRealHeight(14),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextID = StringId.PowerTenerationToday,
@@ -1239,13 +1275,22 @@
                };
                inverterListView.AddChidren(btnPowerTenerationToday);
                Button btnCurrentPowerGenerationIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnPowerTenerationToday.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(14),
                    Height = Application.GetRealWidth(14),
                    UnSelectedImagePath = "FunctionIcon/Inverter/Icon3.png"
                };
                inverterListView.AddChidren(btnCurrentPowerGenerationIcon);
                Button btnCurrentPowerGeneration = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnPowerTenerationToday.Bottom + Application.GetRealHeight(5),
                    X = Application.GetRealWidth(37),
                    Y = btnPowerTenerationToday.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(148),
                    Height = Application.GetRealHeight(21),
                    Height = Application.GetRealHeight(14),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextID = StringId.CurrentPowerGeneration,
@@ -1253,17 +1298,17 @@
                };
                inverterListView.AddChidren(btnCurrentPowerGeneration);
                Button btnBatterySOC = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnCurrentPowerGeneration.Bottom,
                    Width = Application.GetRealWidth(148),
                    Height = Application.GetRealHeight(18),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextID = StringId.BatterySOC,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                //Button btnBatterySOC = new Button()
                //{
                //    X = Application.GetRealWidth(37),
                //    Y = btnCurrentPowerGeneration.Bottom,
                //    Width = Application.GetRealWidth(148),
                //    Height = Application.GetRealHeight(18),
                //    TextColor = CSS_Color.FirstLevelTitleColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    TextID = StringId.BatterySOC,
                //    TextAlignment = TextAlignment.CenterLeft,
                //};
                //inverterListView.AddChidren(btnBatterySOC);
                //Button btnOperationDataTotalData = new Button()
@@ -1289,7 +1334,7 @@
                    };
//#if __Android__
                    //适配安卓沉浸式导航栏
                    //适配沉浸式导航栏
                    h5BasePage.Y = Application.GetRealHeight(20);
                    h5BasePage.Height = Application.GetRealHeight(646);
//#endif
@@ -1302,8 +1347,9 @@
                    {
                        lz = "en";
                    }
                    string url = $"h5/index.html?homeId={DB_ResidenceData.Instance.CurrentRegion.id}&token={UserInfo.Current.AccessToken}&refresh_token={UserInfo.Current.RefreshToken}&url={HttpUtil.GlobalRequestHttpsHost}&lang={lz}";
                    string url = $"h5/index.html?homeId={DB_ResidenceData.Instance.CurrentRegion.id}&token={UserInfo.Current.AccessToken}&refresh_token={UserInfo.Current.RefreshToken}&url={HttpUtil.GlobalRequestHttpsHost}&language={lz}";
                    Inverter.Ins.ShowWebviewFormUrl(url);
                    Inverter.Ins.H5Page.JSToNativeAction = (dictionary) =>
                    {
                        JObject jObj = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(dictionary));
@@ -1339,9 +1385,9 @@
                            {
                                h5BasePage.RemoveFromParent();
                            });
                            refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration, btnBatterySOC);
                            refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration);
                        }
                        else if(jObj["method"].ToString() == "setPageIndex")
                        else if (jObj["method"].ToString() == "setPageIndex")
                        {
                            var data = jObj["data"].ToString();
                            Inverter.Ins.PageIndex = data.ToString();
@@ -1352,7 +1398,7 @@
                };
                refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration, btnBatterySOC);
                refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration);
                index++;
            }
@@ -1362,7 +1408,7 @@
            #endregion
        }
        void refreshInverterInfo(Button btnPowerTenerationToday, Button btnWorkingMode, Button btnCurrentPowerGeneration, Button btnBatterySOC)
        void refreshInverterInfo(Button btnPowerTenerationToday, Button btnWorkingMode, Button btnCurrentPowerGeneration)
        {
            new System.Threading.Thread(() =>
            {
@@ -1383,10 +1429,40 @@
                    {
                        Application.RunOnMainThread(() =>
                        {
                            btnPowerTenerationToday.Text = Language.StringByID(StringId.PowerTenerationToday).Replace("----", info.totalElectricityPvToday);
                            btnWorkingMode.Text = Language.StringByID(StringId.WorkingMode).Replace("----", info.workMode);
                            btnCurrentPowerGeneration.Text = Language.StringByID(StringId.CurrentPowerGeneration).Replace("----", info.powerPvNow);
                            btnBatterySOC.Text = Language.StringByID(StringId.BatterySOC).Replace("--", info.batterySoc);
                            btnPowerTenerationToday.Text = info.totalElectricityPvToday + "kW·h";// Language.StringByID(StringId.PowerTenerationToday).Replace("----", info.totalElectricityPvToday);
                            string workModeString = "";
                            if (Language.CurrentLanguage == "Chinese") {
                                switch (info.workMode)
                                {
                                    case "self_use":
                                        workModeString = "自发自用";
                                        break;
                                    case "peak_load_shifting":
                                        workModeString = "削峰填谷";
                                        break;
                                    case "battery_priority":
                                        workModeString = "电池优先";
                                        break;
                                }
                            }
                            else
                            {
                                switch (info.workMode)
                                {
                                    case "self_use":
                                        workModeString = "Self Consume";
                                        break;
                                    case "peak_load_shifting":
                                        workModeString = "Peak Shift";
                                        break;
                                    case "battery_priority":
                                        workModeString = "Battery Priority";
                                        break;
                                }
                            }
                            btnWorkingMode.Text = workModeString;// Language.StringByID(StringId.WorkingMode).Replace("----", workModeString);
                            btnCurrentPowerGeneration.Text = info.powerPvNow + "w";// Language.StringByID(StringId.CurrentPowerGeneration).Replace("----", info.powerPvNow);
                            //btnBatterySOC.Text = Language.StringByID(StringId.BatterySOC).Replace("--", info.batterySoc);
                        });
                    }
                    catch (Exception ex)