wxr
2023-09-05 1de638833e4b07b5e6c272cf5c8474b5c92ce42f
OnPro/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -80,11 +80,13 @@
        public void LoadPage()
        {
            //MainPage.BaseTopButton.BackgroundColor = 0xFFF7F7F7;
            MainPage.CurPageIndex = 1;
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            bodyView.BackgroundColor = CSS_Color.TopViewColor;
            #region top
            FrameLayout topView = new FrameLayout()
            {
                Y = Application.GetRealHeight(10),
                Height = Application.GetRealHeight(64),
                BackgroundColor = CSS_Color.TopViewColor,
            };
@@ -122,7 +124,7 @@
            contentPageView = new PageLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64 - 49 + 30),
                Height = Application.GetRealHeight(667 - 64 - 49 + 30 - 10),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                IsShowPoint = false
            };
@@ -749,9 +751,9 @@
                    TextAlignment = TextAlignment.CenterLeft,
                    IsMoreLines = true,
                };
                functionView.AddChidren(btnName);
                functionView.AddChidren(btnName);
                if (item != ShowFunction.FreshAir && functionCount != 0)
                if (functionCount != 0)
                {
                    Button btnFunctionCount = new Button()
                    {
@@ -764,6 +766,22 @@
                        TextAlignment = TextAlignment.CenterLeft,
                        Text = "/" + functionCount,
                    };
                    functionView.AddChidren(btnFunctionCount);
                    Button btnOpenCount = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        Y = btnName.Bottom,
                        Width = Application.GetRealWidth(14 * functionCount.ToString().Length),
                        Height = Application.GetRealHeight(24),
                        TextColor = CSS_Color.MainColor,
                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                        TextAlignment = TextAlignment.CenterLeft,
                        Text = functionOnCount.ToString(),
                        Tag = item + "_onCount",
                        BorderWidth = 0,
                    };
                    functionView.AddChidren(btnOpenCount);
                }
@@ -905,7 +923,13 @@
                        break;
                }
                btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
                    var skipView = new FunctionPage();
                    MainPage.BasePageView.AddChidren(skipView);
                    skipView.LoadPage(functionPageTitleId);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                index++;
            }
@@ -916,74 +940,6 @@
        }
       
        void refreshInverterInfo(Button btnPowerTenerationToday, Button btnWorkingMode, Button btnCurrentPowerGeneration)
        {
            new System.Threading.Thread(() =>
            {
                var http = new HttpServerRequest();
                var pack = http.GetInverterStatisticsInfo();
                if (pack != null)
                {
                    if(pack.Data == null)
                    {
                        return;
                    }
                    var info = JsonConvert.DeserializeObject<StatisticsInfo>(pack.Data?.ToString());
                    if (info == null)
                    {
                        return;
                    }
                    try
                    {
                        Application.RunOnMainThread(() =>
                        {
                            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)
                    {
                        MainPage.Log($"获取家庭光伏统计数据异常:{ex.Message}");
                    }
                }
            })
            { IsBackground = true }.Start();
        }
#region 切换楼层
        /// <summary>