wxr
2022-10-18 6692d867a0876b014be3cbd64bc3a237a026dc2d
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -1091,7 +1091,11 @@
                            string onoff = btnAcstPower.IsSelected ? "on" : "off";
                            Dictionary<string, string> d = new Dictionary<string, string>();
                            d.Add(FunctionAttributeKey.OnOff, onoff);
                            Control.Ins.SendWriteCommand(FunctionList.List.GetAcstParentList()[0], d);
                            foreach (var temp in FunctionList.List.GetAcstParentList())
                            {
                                Control.Ins.SendWriteCommand(temp, d);
                            }
                        };
@@ -1182,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().Count.ToString(),
                    Text = count.ToString(),
                    Tag = "inverter_onCount",
                    BorderWidth = 0,
                };
                inverterListView.AddChidren(btnOpenCount);
                //Button btnWorkStatus = new Button()
                //{
@@ -1209,12 +1227,23 @@
                //};
                //inverterListView.AddChidren(btnWorkStatus);
                Button btnWorkingMode = new Button()
                Button btnWorkingModeIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnOpenCount.Bottom,// + Application.GetRealHeight(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,
@@ -1222,12 +1251,23 @@
                };
                inverterListView.AddChidren(btnWorkingMode);
                Button btnPowerTenerationToday = new Button()
                Button btnPowerTenerationTodayIcon = new Button()
                {
                    X = Application.GetRealWidth(16),
                    Y = btnWorkingMode.Bottom,
                    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,
@@ -1235,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,
                    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,
@@ -1249,18 +1298,18 @@
                };
                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,
                };
                inverterListView.AddChidren(btnBatterySOC);
                //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()
                //{
@@ -1280,13 +1329,15 @@
                clickButton.MouseUpEventHandler = (sender2, e2) =>
                {
                    var h5BasePage = new FrameLayout();
                    var h5BasePage = new FrameLayout() {
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                    };
#if __Android__
                    //适配安卓沉浸式导航栏
//#if __Android__
                    //适配沉浸式导航栏
                    h5BasePage.Y = Application.GetRealHeight(20);
                    h5BasePage.Height = Application.GetRealHeight(646);
#endif
//#endif
                    MainPage.BasePageView.AddChidren(h5BasePage);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -1296,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));
@@ -1333,12 +1385,20 @@
                            {
                                h5BasePage.RemoveFromParent();
                            });
                            refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration, btnBatterySOC);
                            refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration);
                        }
                        else if (jObj["method"].ToString() == "setPageIndex")
                        {
                            var data = jObj["data"].ToString();
                            Inverter.Ins.PageIndex = data.ToString();
                        }
                    };
                };
                refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration, btnBatterySOC);
                refreshInverterInfo(btnPowerTenerationToday, btnWorkingMode, btnCurrentPowerGeneration);
                index++;
            }
@@ -1348,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(() =>
            {
@@ -1356,6 +1416,10 @@
                var pack = http.GetInverterStatisticsInfo();
                if (pack != null)
                {
                    if(pack.Data == null)
                    {
                        return;
                    }
                    var info = JsonConvert.DeserializeObject<StatisticsInfo>(pack.Data?.ToString());
                    if (info == null)
                    {
@@ -1365,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)