From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs |  410 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 233 insertions(+), 177 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
index cee8a68..97c577b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
@@ -16,7 +16,9 @@
     {
         static AcstParentPage basePage;
 
-        VerticalScrolViewLayout bodyView;
+        VerticalScrolViewLayout contentView;
+
+        string helloText = "涓婂崍濂�";
 
         #region 澶╂皵鎺т欢
         Button btnOutdoorTemp;
@@ -64,132 +66,7 @@
         public AcstParentPage()
         {
             basePage = this;
-            this.function = FunctionList.List.GetAcstParentList()[0];
-            this.BackgroundColor = CSS.CSS_Color.BackgroundColor;
-            bodyView = new VerticalScrolViewLayout();
-            this.AddChidren(bodyView);
-            subViewList = new Dictionary<string, AcstSubControlView>();
-        }
-        /// <summary>
-        /// 鏇存柊澶╂皵淇℃伅
-        /// </summary>
-        public void InitGetWeatherAction()
-        {
-            MainPage.CityWeatherAction = () =>
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    btnOutdoorTemp.Text = MainPage.cityInfo.temperature + "掳";
-                    btnWeather.Text = MainPage.cityInfo.weather;
-                    btnHumidityValues.Text = MainPage.cityInfo.humidity + "%";
-                    btnHumidityValues.Width = btnHumidityValues.GetTextWidth() + Application.GetRealWidth(10);
-                    btnPm25Values.Text = MainPage.cityInfo.pm25;
-                    btnPm25Values.Width = btnPm25Values.GetTextWidth() + Application.GetRealWidth(10);
-                });
-            };
-        }
-        /// <summary>
-        /// 鏇存柊涓绘帶鏁版嵁淇℃伅
-        /// </summary>
-        public static void UpdateAcstParentInfo(Function temp)
-        {
-            if (basePage == null)
-            {
-                return;
-            }
-            Application.RunOnMainThread(() =>
-            {
-                if (basePage.sensorDiyView_Temp != null)
-                    basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state,true);
-                if (basePage.sensorDiyView_Humi != null)
-                    basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state, true);
-                if (basePage.sensorDiyView_Pm25 != null)
-                    basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state,false);
-                if (basePage.sensorDiyView_Co2 != null)
-                    basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state, false);
-                if (basePage.sensorDiyView_Tvoc != null)
-                    basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state, false);
-                if (basePage.sensorDiyView_EleDay != null)
-                    basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state, false);
-                if (basePage.sensorDiyView_EleMonth != null)
-                    basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state, false);
-                if (basePage.sensorDiyView_EleActivePower != null)
-                    basePage.sensorDiyView_EleActivePower.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.active_power.ToString()).state, false);
-
-
-
-                switch (temp.GetAttrState("mode"))
-                {
-                    case "cool"://鍒跺喎
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png";
-                        break;
-                    case "heat"://鍒剁儹
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png";
-                        break;
-                    case "fan"://閫氶
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png";
-                        break;
-                    case "dry"://闄ゆ箍
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png";
-                        break;
-                    case "humidity"://鍔犳箍
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png";
-                        break;
-                    case "heat_humidity"://鍒剁儹鍔犳箍
-                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png";
-                        basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png";
-                        break;
-                }
-                switch (temp.GetAttrState("scene"))
-                {
-                    case "at_home"://鍦ㄥ
-                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png";
-                        basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAtHome2.png";
-                        break;
-                    case "leave_home"://绂诲
-                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png";
-                        basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png";
-                        break;
-                    case "sleep"://鐫$湢
-                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png";
-                        basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png";
-                        break;
-                }
-                basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.GetAttrState("on_off") == "on";
-            });
-        }
-
-
-        /// <summary>
-        /// 鏇存柊瀛愭帶淇℃伅
-        /// </summary>
-        /// <param name="temp"></param>
-        public static void UpdateAcstSubInfo(Function temp)
-        {
-            if(basePage == null)
-            {
-                return;
-            }
-            Application.RunOnMainThread(() => {
-                var view = basePage.subViewList[temp.sid];
-                if(view!= null)
-                {
-                    view.btnSubHumidityValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%";
-                    view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "掳";
-                    view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on";
-                }
-            });
-        }
-
-        public void LoadPage()
-        {
             var curTime = DateTime.Now;
-            string helloText = "涓婂崍濂�"; 
             if (Language.CurrentLanguage != "Chinese")
             {
                 helloText = "Good morning";
@@ -221,18 +98,165 @@
                 {
                     helloText = "Good evening";
                 }
-                
+
                 curColor = 0xFF9175F3;
                 imageFolder = "purple";
             }
+            this.function = FunctionList.List.GetAcstParentList()[0];
+            this.BackgroundColor = CSS.CSS_Color.BackgroundColor;
+            //this.AddChidren(new Button() { Height = Application.GetRealHeight(50), BackgroundColor = curColor });
+            contentView = new VerticalScrolViewLayout() {
+                Height = Application.GetRealHeight(667 - 56),
+            };
+            this.AddChidren(contentView);
+            subViewList = new Dictionary<string, AcstSubControlView>();
+        }
+        /// <summary>
+        /// 鏇存柊澶╂皵淇℃伅
+        /// </summary>
+        public void InitGetWeatherAction()
+        {
+            MainPage.CityWeatherAction = () =>
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    btnOutdoorTemp.Text = MainPage.cityInfo.temperature + "掳";
+                    btnWeather.Text = MainPage.cityInfo.weather;
+                    btnHumidityValues.Text = MainPage.cityInfo.humidity + "%";
+                    btnHumidityValues.Width = btnHumidityValues.GetTextWidth() + Application.GetRealWidth(10);
+                    btnPm25Values.Text = MainPage.cityInfo.pm25;
+                    btnPm25Values.Width = btnPm25Values.GetTextWidth() + Application.GetRealWidth(10);
+                });
+            };
+        }
+        /// <summary>
+        /// 鏇存柊涓绘帶鏁版嵁淇℃伅
+        /// </summary>
+        public static void UpdateAcstParentInfo(Function temp)
+        {
+            try
+            {
+                if (basePage == null)
+                {
+                    return;
+                }
+                Application.RunOnMainThread(() =>
+                {
+                    if (basePage.sensorDiyView_Temp != null)
+                        basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state, true);
+                    if (basePage.sensorDiyView_Humi != null)
+                        basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state, true);
+                    if (basePage.sensorDiyView_Pm25 != null)
+                        basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state, false);
+                    if (basePage.sensorDiyView_Co2 != null)
+                        basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state, false);
+                    if (basePage.sensorDiyView_Tvoc != null)
+                        basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state, false);
+                    if (basePage.sensorDiyView_EleDay != null)
+                        basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state, false);
+                    if (basePage.sensorDiyView_EleMonth != null)
+                        basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state, false);
+                    if (basePage.sensorDiyView_EleActivePower != null)
+                        basePage.sensorDiyView_EleActivePower.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.active_power.ToString()).state, false);
 
+
+
+                    switch (temp.GetAttrState("mode"))
+                    {
+                        case "cool"://鍒跺喎
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png";
+                            break;
+                        case "heat"://鍒剁儹
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png";
+                            break;
+                        case "fan"://閫氶
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png";
+                            break;
+                        case "dry"://闄ゆ箍
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png";
+                            break;
+                        case "humidity"://鍔犳箍
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png";
+                            break;
+                        case "heat_humidity"://鍒剁儹鍔犳箍
+                        basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png";
+                            basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png";
+                            break;
+                    }
+                    switch (temp.GetAttrState("scene"))
+                    {
+                        case "at_home"://鍦ㄥ
+                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png";
+                            basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAtHome2.png";
+                            break;
+                        case "leave_home"://绂诲
+                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png";
+                            basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png";
+                            break;
+                        case "sleep"://鐫$湢
+                        basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png";
+                            basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png";
+                            break;
+                    }
+                    basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.GetAttrState("on_off") == "on";
+                });
+            }catch (Exception ex)
+            {
+                MainPage.Log("绉戞妧绯荤粺鏇存柊鏁版嵁澶辫触");
+            }
+        }
+
+
+        /// <summary>
+        /// 鏇存柊瀛愭帶淇℃伅
+        /// </summary>
+        /// <param name="temp"></param>
+        public static void UpdateAcstSubInfo(Function temp)
+        {
+            try
+            {
+                if (basePage == null)
+                {
+                    return;
+                }
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        AcstSubControlView view = null;
+                        basePage.subViewList.TryGetValue(temp.sid, out view);
+                        if (view != null)
+                        {
+                            view.btnSubHumidityValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%";
+                            view.btnSubTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "掳";
+                            view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on";
+                        }
+                    }
+                    catch (Exception ex ) {
+                        MainPage.Log($"绉戞妧绯荤粺鏇存柊寮傚父1:{ex.Message}");
+                    }
+                });
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log($"绉戞妧绯荤粺鏇存柊寮傚父123:{ex.Message}");
+            }
+        }
+
+        public void LoadPage()
+        {
             #region 澶撮儴淇℃伅鍖哄煙
             FrameLayout topView = new FrameLayout()
             {
                 Height = Application.GetRealHeight(180),
                 BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/TopViewBg.png",
             };
-            bodyView.AddChidren(topView);
+            contentView.AddChidren(topView);
 
             var backView = new FrameLayout()
             {
@@ -353,7 +377,7 @@
 
             #endregion
 
-            bodyView.AddChidren(new Button
+            contentView.AddChidren(new Button
             {
                 Height = Application.GetRealHeight(8),
             });
@@ -417,7 +441,7 @@
                     Height = Application.GetRealHeight(104),
                     BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                 };
-                bodyView.AddChidren(infoView);
+                contentView.AddChidren(infoView);
 
                 var infoContentView = new FrameLayout()
                 {
@@ -442,23 +466,33 @@
 
                 if (tempObj != null)
                 {
-                    sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "掳", Language.StringByID(StringId.Temp));
+                    string tempValues = tempObj.state == "" ? "--" : tempObj.state;
+                    if (tempValues.Contains("."))
+                    {
+                        tempValues = tempValues.Remove(tempValues.IndexOf('.'), tempValues.Length - tempValues.IndexOf('.'));
+                    }
+                    sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempValues, "掳","", Language.StringByID(StringId.Temp));
                 }
                 if (humiObj != null)
                 {
-                    sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity));
+                    string humiValues = humiObj.state == "" ? "--" : humiObj.state;
+                    if (humiValues.Contains("."))
+                    {
+                        humiValues = humiValues.Remove(humiValues.IndexOf('.'), humiValues.Length - humiValues.IndexOf('.'));
+                    }
+                    sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiValues , "%", "", Language.StringByID(StringId.Humidity));
                 }
                 if (pm25Obj != null)
                 {
-                    sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "", "PM2.5");
+                    sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "", "", "PM2.5");
                 }
                 if (co2Obj != null)
                 {
-                    sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "", "CO2");
+                    sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "", "", "CO2");
                 }
                 if (tvocObj != null)
                 {
-                    sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "", "TVOC");
+                    sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "", "", "TVOC");
                 }
                 #endregion
 
@@ -480,7 +514,7 @@
                     {
                         text = "Power";
                     }
-                    sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state, "KW", text, 100);
+                    sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state, "", "KW", text, 100);
                 }
                 if (dayObj != null)
                 {
@@ -489,7 +523,7 @@
                     {
                         text = "Power of today";
                     }
-                    sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "KWh", text, 100);
+                    sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "", "KWh", text, 100);
                 }
                 if (monthObj != null)
                 {
@@ -498,7 +532,7 @@
                     {
                         text = "Power of month";
                     }
-                    sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state, "KWh", text, 100);
+                    sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state, "", "KWh", text, 100);
                 }
 
 
@@ -536,7 +570,7 @@
             {
                 Height = Application.GetRealHeight(54-11),
             };
-            bodyView.AddChidren(subTitleView);
+            contentView.AddChidren(subTitleView);
 
             var btnCollection = new Button()
             {
@@ -563,7 +597,7 @@
             var btnTitleText2 = new Button()
             {
                 X = btnCollection.Right,
-                Text = "鎴戠殑瀹跺涵",
+                TextID = StringId.MyHome,
                 TextSize = 16,
                 TextColor = 0xFF242424,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -571,10 +605,6 @@
                 Height = Application.GetRealHeight(54),
             };
             subTitleView.AddChidren(btnTitleText2);
-            if(Language.CurrentLanguage != "Chinese")
-            {
-                btnTitleText2.Text = "My Home";
-            }
 
             int subFunctionCount = 0;
 
@@ -582,42 +612,60 @@
             {
                 Height = Application.GetRealHeight(88),
             };
-            bodyView.AddChidren(subFunctionListView);
+            contentView.AddChidren(subFunctionListView);
 
 
             subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) });
-            foreach (var sub in FunctionList.List.GetAcstSubList())
+            new System.Threading.Thread(() =>
             {
-                if (subViewList.ContainsKey(sub.sid))
+                try
                 {
-                    continue;
-                }
+#if DEBUG
+                    System.Threading.Thread.Sleep(200);
+#endif
 
-                if (subFunctionCount > 0 && subFunctionCount % 2 == 0)
-                {
-                    subFunctionListView = new HorizontalScrolViewLayout()
+                    foreach (var sub in FunctionList.List.GetAcstSubList())
                     {
-                        Height = Application.GetRealHeight(93),
-                    };
-                    bodyView.AddChidren(subFunctionListView);
-                    subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) });
+                        if (subViewList.ContainsKey(sub.sid))
+                        {
+                            continue;
+                        }
+
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (subFunctionCount > 0 && subFunctionCount % 2 == 0)
+                            {
+                                subFunctionListView = new HorizontalScrolViewLayout()
+                                {
+                                    Height = Application.GetRealHeight(93),
+                                };
+                                contentView.AddChidren(subFunctionListView);
+                                subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) });
+                            }
+
+                            AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView, imageFolder);
+                            subViewList.Add(sub.sid, subFunctionView);
+                            if (basePage != null)
+                            {
+                                new System.Threading.Thread(() =>
+                                {
+                                    Control.Ins.SendReadCommand(sub);
+                                })
+                                { IsBackground = true }.Start();
+                            }
+                        subFunctionCount++;
+                        });
+
+                        System.Threading.Thread.Sleep(10);
+                    }
                 }
-
-                AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView,imageFolder);
-
-                subViewList.Add(sub.sid, subFunctionView);
-
-                Control.Ins.SendReadCommand(sub);
-
-                subFunctionCount++;
-            }
-
+                catch { }
+                finally{
+             
+                }
+            }).Start();
             #endregion
 
-            bodyView.AddChidren(new Button()
-            {
-                Height = Application.GetRealHeight(72),
-            });
 
             #region 搴曢儴鎺у埗鏍�
             var bottomView = new FrameLayout()
@@ -1006,7 +1054,7 @@
                     Language.StringByID(StringId.AtHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString());
                     atHomeIconButton.Click(() =>
                     {
-                        btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png";
+                        btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png";
                         dialog.Close();
                         new System.Threading.Thread(() =>
                         {
@@ -1043,7 +1091,7 @@
                         Language.StringByID(StringId.AwayHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString());
                     awayHomeIconButton.Click(() =>
                     {
-                        btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png";
+                        btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png";
                         dialog.Close();
                         new System.Threading.Thread(() =>
                         {
@@ -1081,7 +1129,7 @@
                         Language.StringByID(StringId.Sleep), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString());
                     sleepIconButton.Click(() =>
                     {
-                        btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png";
+                        btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png";
                         dialog.Close();
                         new System.Threading.Thread(() =>
                         {
@@ -1105,7 +1153,11 @@
 
             InitGetWeatherAction();
 
-            Control.Ins.SendReadCommand(function);
+            new System.Threading.Thread(() =>
+            {
+                Control.Ins.SendReadCommand(function);
+            })
+            { IsBackground = true }.Start();
 
         }
 
@@ -1124,7 +1176,7 @@
         public string Tag;
         public string unitString;
 
-        public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string unitStr,string text,int setWidth = 60)
+        public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string unitStr, string unitStr2, string text,int setWidth = 60)
         {
             unitString = unitStr;
             if (string.IsNullOrEmpty(value))
@@ -1149,7 +1201,7 @@
                 TextAlignment = TextAlignment.Center,
                 TextColor = color,
                 TextSize = 20,
-                Text = value,
+                Text = value + unitString,
             };
             contentView.AddChidren(btnValue);
 
@@ -1160,10 +1212,14 @@
                 TextAlignment = TextAlignment.Center,
                 TextColor = 0xFF949AA5,
                 TextSize = 12,
-                Text = text + "(" + unitString+")",
+                Text = text ,
             };
             contentView.AddChidren(btnText);
 
+            if(!string.IsNullOrEmpty(unitStr2))
+            {
+                btnText.Text += "(" + unitStr2 + ")";
+            }
 
 
         }

--
Gitblit v1.8.0