From 0ee75b88cfe03e46289de0de96e8ed4580c797d3 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 27 九月 2022 14:04:21 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into dev--wxr

---
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs |  958 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 808 insertions(+), 150 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
index 582e49d..e071faa 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
@@ -1,4 +1,6 @@
 锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using Shared;
 
@@ -12,39 +14,204 @@
 	/// </summary>
     public class AcstParentPage : FrameLayout
     {
+        static AcstParentPage basePage;
+
         VerticalScrolViewLayout bodyView;
+
+        #region 澶╂皵鎺т欢
+        Button btnOutdoorTemp;
+        Button btnWeather;
+        TextButton btnHumidityValues;
+        TextButton btnPm25Values;
+        #endregion
+
+        #region 浼犳劅鍣ㄣ�佽�楃數閲忕粍浠�
+        SensorDiyView sensorDiyView_Temp;
+        SensorDiyView sensorDiyView_Humi;
+        SensorDiyView sensorDiyView_Pm25;
+        SensorDiyView sensorDiyView_Co2;
+        SensorDiyView sensorDiyView_Tvoc;
+        SensorDiyView sensorDiyView_EleDay;
+        SensorDiyView sensorDiyView_EleMonth;
+        SensorDiyView sensorDiyView_EleTotal;
+        #endregion
+        /// <summary>
+        /// 瀛愭帶鍖哄煙鍒楄〃
+        /// </summary>
+        Dictionary<string, AcstSubControlView> subViewList;
+
+
+        Button btnWorkSceneControl;
+
+        Button btnModeControl;
+        Button btnPowerControl;
+
+
+        public override void RemoveFromParent()
+        {
+            base.RemoveFromParent();
+            basePage = null;
+        }
+
         Function function;
         /// <summary>
         /// 褰撳墠鏃舵棰滆壊
         /// </summary>
         uint curColor = CSS.CSS_Color.MainColor;
 
+        string imageFolder = "blue";
+
         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;
+            }
+            if (basePage.sensorDiyView_Temp != null)
+                basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state);
+            if (basePage.sensorDiyView_Humi != null)
+                basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state);
+            if (basePage.sensorDiyView_Pm25 != null)
+                basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state);
+            if (basePage.sensorDiyView_Co2 != null)
+                basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state);
+            if (basePage.sensorDiyView_Tvoc != null)
+                basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state);
+            if (basePage.sensorDiyView_EleDay != null)
+                basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state);
+            if (basePage.sensorDiyView_EleMonth != null)
+                basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state);
+            if (basePage.sensorDiyView_EleTotal != null)
+                basePage.sensorDiyView_EleTotal.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.total_electricity.ToString()).state);
 
 
+            basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.trait_on_off.state == "on";
 
+            switch (temp.GetAttrState("mode"))
+            {
+                case "cool"://鍒跺喎
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png";
+                    break;
+                case "heat"://鍒剁儹
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png";
+                    break;
+                case "fan"://閫氶
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png";
+                    break;
+                case "dry"://闄ゆ箍
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png";
+                    break;
+                case "humidity"://鍔犳箍
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png";
+                    break;
+                case "heat_humidity"://鍒剁儹鍔犳箍
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png";
+                    break;
+            }
+            switch (temp.GetAttrState("scene"))
+            {    
+                case "at_home"://鍦ㄥ
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png";
+                    break;
+                case "leave_home"://绂诲
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png";
+                    break;
+                case "sleep"://鐫$湢
+                    basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png";
+                    basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png";
+                    break;
+            }
 
         }
 
-        public void InitGetWeatherAction()
-        {
-            MainPage.CityWeatherAction = () => {
 
-            };
+        /// <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_humidity.ToString()) + "%";
+                    view.btnSubPower.IsSelected = temp.GetAttrState(AcstSub_AttrEnum.on_off.ToString()) == "on";
+                }
+            });
         }
 
         public void LoadPage()
         {
+            var curTime = DateTime.Now;
+            string helloText = "涓婂崍濂�";
+            if (curTime.Hour >= 8 && curTime.Hour < 12)
+            {
+                helloText = "涓婂崍濂�";
+                curColor = CSS.CSS_Color.MainColor;
+                imageFolder = "blue";
+            }
+            else if (curTime.Hour >= 12 && curTime.Hour < 18)
+            {
+                helloText = "涓嬪崍濂�";
+                curColor = 0xFFE7914F;
+                imageFolder = "orange";
+            }
+            else
+            {
+                helloText = "鏅氫笂濂�";
+                curColor = 0xFF9175F3;
+                imageFolder = "purple";
+            }
+
             #region 澶撮儴淇℃伅鍖哄煙
             FrameLayout topView = new FrameLayout()
             {
-                Height = Application.GetRealHeight(181),
-                BackgroundColor = 0xFFb0eafa,
+                Height = Application.GetRealHeight(180),
+                BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/TopViewBg.png",
             };
             bodyView.AddChidren(topView);
 
@@ -53,20 +220,22 @@
                 Y = Application.GetRealHeight(32),
                 Width = Application.GetRealWidth(100),
                 Height = Application.GetRealHeight(34),
-                BackgroundColor = 0x33333333,
             };
             topView.AddChidren(backView);
 
             Button btnBackIcon = new Button()
             {
                 X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(40),
-                Height = Application.GetRealWidth(28),
-                UnSelectedImagePath = "Public/BackIcon.png",
+                Width = Application.GetRealWidth(12),
+                Height = Application.GetRealHeight(20),
+                UnSelectedImagePath = "FunctionIcon/Acst/BackIcon.png",
             };
             backView.AddChidren(btnBackIcon);
 
-            btnBackIcon.MouseUpEventHandler = (sender, e) => {
+            Button btnBackClick = new Button();
+            backView.AddChidren(btnBackClick);
+
+            btnBackClick.MouseUpEventHandler = (sender, e) => {
                 this.RemoveFromParent();
             };
 
@@ -77,25 +246,14 @@
                 Width = Application.GetRealWidth(200),
                 Height = Application.GetRealHeight(38),
                 TextSize = 20,
+                Text = helloText,
                 TextColor = 0xFFFFFFFF,
                 TextAlignment = TextAlignment.CenterLeft,
             };
             topView.AddChidren(btnHelloText);
-            var curTime = DateTime.Now;
-            if (curTime.Hour >= 8 && curTime.Hour < 12)
-            {
-                btnHelloText.Text = "涓婂崍濂�";
-            }
-            else if (curTime.Hour >= 12 && curTime.Hour < 18)
-            {
-                btnHelloText.Text = "涓嬪崍濂�";
-            }
-            else
-            {
-                btnHelloText.Text = "鏅氫笂濂�";
-            }
 
-            var btnOutdoorTemp = new Button()
+
+            btnOutdoorTemp = new Button()
             {
                 X = Application.GetRealWidth(25),
                 Y = Application.GetRealHeight(90),
@@ -108,7 +266,7 @@
             };
             topView.AddChidren(btnOutdoorTemp);
 
-            var btnWeather = new Button()
+            btnWeather = new Button()
             {
                 X = btnOutdoorTemp.Right,
                 Y = Application.GetRealHeight(95),
@@ -120,8 +278,6 @@
                 TextAlignment = TextAlignment.CenterLeft,
             };
             topView.AddChidren(btnWeather);
-
-
 
 
             var environmentalView = new FrameLayout()
@@ -141,7 +297,7 @@
             };
             environmentalView.AddChidren(btnHumidityIcon);
 
-            var btnHumidityValues = new TextButton()
+            btnHumidityValues = new TextButton()
             {
                 X = btnHumidityIcon.Right + Application.GetRealWidth(4),
                 Gravity = Gravity.CenterVertical,
@@ -163,7 +319,7 @@
             };
             environmentalView.AddChidren(btnPm25Icon);
 
-            var btnPm25Values = new TextButton()
+            btnPm25Values = new TextButton()
             {
                 X = btnPm25Icon.Right + Application.GetRealWidth(4),
                 Gravity = Gravity.CenterVertical,
@@ -197,19 +353,19 @@
                 Gravity = Gravity.Center,
                 Width = Application.GetRealWidth(343),
                 Height = Application.GetRealHeight(72),
-                BackgroundColor = 0x22222222,
+                BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/MsgViewBg.png",
             };
             infoView.AddChidren(infoContentView);
 
             #region 浼犳劅鍣ㄦ暟鎹�
             int sensorCount = 0;
             var tempObj = function.GetAttribute(AcstParent_AttrEnum.room_temp.ToString());
-            if(tempObj!= null)
+            if (tempObj != null)
             {
                 sensorCount++;
             }
             var humiObj = function.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString());
-            if(humiObj != null)
+            if (humiObj != null)
             {
                 sensorCount++;
             }
@@ -236,25 +392,26 @@
             };
             infoContentView.AddChidren(sensorListView);
 
+
             if (tempObj != null)
             {
-                new SensorDiyView(sensorListView, curColor, tempObj.curValue.ToString() + "掳", "娓╁害");
+                sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state + "掳", "娓╁害");
             }
             if (humiObj != null)
             {
-                new SensorDiyView(sensorListView, curColor, humiObj.curValue.ToString() + "%", "婀垮害");
+                sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state + "%", "婀垮害");
             }
             if (pm25Obj != null)
             {
-                new SensorDiyView(sensorListView, curColor, pm25Obj.curValue.ToString(), "PM2.5");
+                sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "PM2.5");
             }
             if (co2Obj != null)
             {
-                new SensorDiyView(sensorListView, curColor, co2Obj.curValue.ToString(), "CO2");
+                sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "CO2");
             }
             if (tvocObj != null)
             {
-                new SensorDiyView(sensorListView, curColor, tvocObj.curValue.ToString(), "TVOC");
+                sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "TVOC");
             }
             #endregion
 
@@ -278,22 +435,22 @@
 
             var energyListView = new HorizontalScrolViewLayout()
             {
-                Width = Application.GetRealWidth(60 * energyCount),
+                Width = Application.GetRealWidth(100 * energyCount),
                 Gravity = Gravity.Center,
                 Visible = false,
             };
             infoContentView.AddChidren(energyListView);
             if (dayObj != null)
             {
-                new SensorDiyView(energyListView, curColor, dayObj.curValue.ToString(), "浠婃棩鑰楃數");
+                sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state + "KW", "浠婃棩鑰楃數",100);
             }
             if (monthObj != null)
             {
-                new SensorDiyView(energyListView, curColor, monthObj.curValue.ToString(), "鏈湀鑰楃數");
+                sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state + "KWh", "鏈湀鑰楃數", 100);
             }
             if (totalObj != null)
             {
-                new SensorDiyView(energyListView, curColor, totalObj.curValue.ToString(), "鎬昏�楃數閲�");
+                sensorDiyView_EleTotal = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state + "KWh", "鎬昏�楃數閲�", 100);
             }
 
             var btnChangeClick = new Button();
@@ -325,21 +482,33 @@
 
             var subTitleView = new FrameLayout()
             {
-                Height = Application.GetRealHeight(54),
+                Height = Application.GetRealHeight(54-11),
             };
             bodyView.AddChidren(subTitleView);
 
             var btnCollection = new Button()
             {
                 X = Application.GetRealWidth(6),
-                Gravity = Gravity.CenterVertical,
+                Y = Application.GetRealHeight(10),
                 Width = Application.GetRealWidth(39),
-                Height = Application.GetRealHeight(39),
-                UnSelectedImagePath = "Function/Acst/CollectionIcon_bule.png",
+                Height = Application.GetRealWidth(39),
+                IsSelected = function.collect,
+                UnSelectedImagePath = "FunctionIcon/Acst/grey/CollectionIcon.png",
+                SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/CollectionIcon.png",
             };
             subTitleView.AddChidren(btnCollection);
+            //鏀惰棌
+            btnCollection.MouseUpEventHandler = (sender, e) => {
+                function.collect = !function.collect;
+                btnCollection.IsSelected = function.collect;
 
-            var btnTitleText = new Button()
+                //var http = new DAL.Server.HttpServerRequest();
+                //http.CollectDevice(function.deviceId);
+                function.CollectFunction();
+
+            };
+
+            var btnTitleText2 = new Button()
             {
                 X = btnCollection.Right,
                 Text = "鎴戠殑瀹跺涵",
@@ -347,8 +516,9 @@
                 TextColor = 0xFF242424,
                 TextAlignment = TextAlignment.CenterLeft,
                 IsBold = true,
+                Height = Application.GetRealHeight(54),
             };
-            subTitleView.AddChidren(btnTitleText);
+            subTitleView.AddChidren(btnTitleText2);
 
             int subFunctionCount = 0;
 
@@ -358,95 +528,28 @@
             };
             bodyView.AddChidren(subFunctionListView);
 
-            foreach(var sub in FunctionList.List.GetAcstSubList())
+
+            subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) });
+            foreach (var sub in FunctionList.List.GetAcstSubList())
             {
-                if(subFunctionCount > 0 && subFunctionCount % 2 == 0)
+                if (subViewList.ContainsKey(sub.sid))
+                {
+                    continue;
+                }
+
+                if (subFunctionCount > 0 && subFunctionCount % 2 == 0)
                 {
                     subFunctionListView = new HorizontalScrolViewLayout()
                     {
-                        Height = Application.GetRealHeight(88),
+                        Height = Application.GetRealHeight(93),
                     };
                     bodyView.AddChidren(subFunctionListView);
+                    subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) });
                 }
 
-                subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(16) });
+                AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView,imageFolder);
 
-                var subFunctionView = new FrameLayout() {
-                    Width = Application.GetRealWidth(164),
-                    Height = Application.GetRealHeight(72),
-                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
-                };
-                subFunctionListView.AddChidren(subFunctionView);
-
-                var btnRoomInfo = new Button()
-                {
-                    X = Application.GetRealWidth(18),
-                    Height = Application.GetRealHeight(40),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = 0xFF1b3053,
-                    TextSize = 13,
-                    Text = sub.GetRoomListName(),
-                };
-                subFunctionView.AddChidren(btnRoomInfo);
-
-
-                var btnSubTempIcon = new Button()
-                {
-                    X = Application.GetRealWidth(16),
-                    Y = Application.GetRealHeight(47),
-                    Width = Application.GetMinRealAverage(11),
-                    Height = Application.GetMinRealAverage(11),
-                    UnSelectedImagePath = "FunctionIcon/CAC/HvacCacTempIcon.png",
-                };
-                subFunctionView.AddChidren(btnSubTempIcon);
-                var btnSubTempValues = new TextButton()
-                {
-                    X = btnSubTempIcon.Right,
-                    Y = Application.GetRealHeight(45),
-                    Height = Application.GetRealHeight(14),
-                    Width = Application.GetRealWidth(22),
-                    TextColor =0xFF1b3035,
-                    TextSize = 10,
-                    Text = sub.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "掳C",
-                    TextAlignment = TextAlignment.CenterLeft,
-                };
-                subFunctionView.AddChidren(btnSubTempValues);
-
-                Button btnSubHumidityIcon = new Button()
-                {
-                    X = btnSubTempValues.Right + Application.GetRealWidth(5),
-                    Y = Application.GetRealHeight(47),
-                    Width = Application.GetMinRealAverage(11),
-                    Height = Application.GetMinRealAverage(11),
-                    UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png",
-                };
-                subFunctionView.AddChidren(btnSubHumidityIcon);
-
-                var btnSubHumidityValues = new TextButton()
-                {
-                    X = btnSubHumidityIcon.Right,
-                    Y = Application.GetRealHeight(45),
-                    Height = Application.GetRealHeight(14),
-                    Width = Application.GetRealWidth(22),
-                    TextColor = 0xFF1b3053,
-                    TextSize = 10,
-                    Text = sub.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%",
-                    TextAlignment = TextAlignment.CenterLeft,
-                };
-                subFunctionView.AddChidren(btnSubHumidityValues);
-
-
-                var btnSubPower = new Button()
-                {
-                    X = Application.GetRealWidth(121),
-                    Gravity = Gravity.CenterVertical,
-                    Width = Application.GetRealWidth(28),
-                    Height = Application.GetRealWidth(28),
-                    BackgroundColor = curColor,
-                    Text = "寮�鍏�",
-                    TextAlignment = TextAlignment.Center,
-                };
-                subFunctionView.AddChidren(btnSubPower);
+                subViewList.Add(sub.sid, subFunctionView);
 
 
 
@@ -455,19 +558,10 @@
 
             #endregion
 
-
-
-
-
-
-
-
-
             bodyView.AddChidren(new Button()
             {
                 Height = Application.GetRealHeight(72),
             });
-
 
             #region 搴曢儴鎺у埗鏍�
             var bottomView = new FrameLayout()
@@ -478,45 +572,425 @@
             };
             this.AddChidren(bottomView);
 
-            var btnModeControl = new Button()
+            btnModeControl = new Button()
             {
                 X = Application.GetRealWidth(89),
                 Gravity = Gravity.CenterVertical,
                 Width = Application.GetRealWidth(38),
                 Height = Application.GetRealWidth(38),
-                BackgroundColor = curColor,
-                Text = "妯″紡",
+                UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png",
+                SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon2.png",
                 TextAlignment = TextAlignment.Center,
+                IsSelected = function.trait_on_off.state == "on"
             };
             bottomView.AddChidren(btnModeControl);
-            btnModeControl.MouseUpEventHandler = (sender, e) =>
+            btnModeControl.MouseUpEventHandler = (sender3, e3) =>
             {
+                if(function.trait_on_off.state == "off")
+                {
+                    return;
+                }
+                Dialog dialog = new Dialog();
 
+                var dialogView = new FrameLayout();
+                dialog.AddChidren(dialogView);
+                dialogView.MouseUpEventHandler = (sender, e) => {
+                    dialog.Close();
+                };
+
+                var dialogContentView = new FrameLayout() {
+                    X = Application.GetRealWidth(34),
+                    Y = Application.GetRealHeight(291),
+                    Width = Application.GetRealWidth(148),
+                    Height = Application.GetRealHeight(319),
+                    BackgroundImagePath = "FunctionIcon/Acst/BgChooseMode.png",
+                };
+                dialogView.AddChidren(dialogContentView);
+
+                var titleView = new FrameLayout() {
+                    X = Application.GetRealWidth(2),
+                    Y = Application.GetRealHeight(3),
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(titleView);
+                var btnTitleText = new Button()
+                {
+                    X = Application.GetRealWidth(16),
+                    Width = Application.GetRealWidth(100),
+                    Text = "閫夋嫨妯″紡",
+                    TextSize = 16,
+                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                    IsBold = true,
+                    TextAlignment = TextAlignment.CenterLeft,
+                };
+                titleView.AddChidren(btnTitleText);
+
+                #region 鍒跺喎
+                var coolView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = titleView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(coolView);
+                coolView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton coolIconButton = new IconButton("FunctionIcon/Acst/grey/ModeCoolIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon.png",
+                    Language.StringByID(StringId.Cool),curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "cool");
+                coolIconButton.Click(()=> {
+                    dialog.Close();
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeCoolIcon2.png";
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add(AcstParent_AttrEnum.mode.ToString(), AcstParent_Attr_ModeValueEnum.cool.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    }) { IsBackground = true }.Start();
+                });
+                coolView.AddChidren(coolIconButton);
+                #endregion
+
+
+                #region 鍒剁儹
+                var heatView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = coolView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(heatView);
+                heatView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton heatIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon.png",
+                    Language.StringByID(StringId.Heat), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == "heat");
+                heatIconButton.Click(() => {
+                    dialog.Close();
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatIcon2.png";
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("mode", "heat");
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                heatView.AddChidren(heatIconButton);
+                #endregion 
+
+                #region 闄ゆ箍
+                var dehumiView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = heatView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(dehumiView);
+                dehumiView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton dehumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeDeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon.png",
+                    Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.dry.ToString());
+                dehumiIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("mode", AcstParent_Attr_ModeValueEnum.dry.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                dehumiView.AddChidren(dehumiIconButton);
+                #endregion 
+
+                #region 閫氶
+                var fanView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = dehumiView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(fanView);
+                fanView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton fanIconButton = new IconButton("FunctionIcon/Acst/grey/ModeFanIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon.png",
+                    Language.StringByID(StringId.Ventilated), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.fan.ToString());
+                fanIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeFanIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("mode", AcstParent_Attr_ModeValueEnum.fan.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                fanView.AddChidren(fanIconButton);
+                #endregion 
+
+                #region 鍒剁儹闄ゆ箍
+                var heatHumiView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = fanView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(heatHumiView);
+                heatHumiView.AddChidren(new Button
+                {
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(112),
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton heatHumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHeatHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon.png",
+                    "鍒剁儹闄ゆ箍", curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.heat_humidity.ToString());
+                heatHumiIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHeatHumiIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("mode", AcstParent_Attr_ModeValueEnum.heat_humidity.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                heatHumiView.AddChidren(heatHumiIconButton);
+                #endregion 
+
+                #region 鍔犳箍
+                var humiView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = heatHumiView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(humiView);
+                humiView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton humiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon.png",
+                    "鍔犳箍", curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.humidity.ToString());
+                humiIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeHumiIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("mode", AcstParent_Attr_ModeValueEnum.humidity.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                humiView.AddChidren(humiIconButton);
+                #endregion 
+
+                dialog.Show();
             };
 
-            var btnPowerControl = new Button()
+            btnPowerControl = new Button()
             {
                 Gravity = Gravity.Center,
                 Width = Application.GetRealWidth(38),
                 Height = Application.GetRealWidth(38),
-                BackgroundColor = curColor,
-                Text = "寮�鍏�",
+                UnSelectedImagePath = "FunctionIcon/Acst/grey/PowerOffIcon.png",
+                SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/PowerIcon.png",
                 TextAlignment = TextAlignment.Center,
+                IsSelected = function.trait_on_off.state == "on"
             };
             bottomView.AddChidren(btnPowerControl);
+            btnPowerControl.MouseUpEventHandler = (sender, e) => {
+                btnPowerControl.IsSelected = !btnPowerControl.IsSelected;
+
+                new System.Threading.Thread(() => {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("onoff", btnPowerControl.IsSelected ? "on" : "off");
+                    Control.Ins.SendWriteCommand(function, d);
+                })
+                { IsBackground = true }.Start();
+            };
 
 
-            var btnWorkSceneControl = new Button()
+            btnWorkSceneControl = new Button()
             {
                 Gravity = Gravity.CenterVertical,
                 X = Application.GetRealWidth(249),
                 Width = Application.GetRealWidth(38),
                 Height = Application.GetRealWidth(38),
-                BackgroundColor = curColor,
-                Text = "鍦烘櫙",
+                UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png",
+                SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png",
                 TextAlignment = TextAlignment.Center,
+                IsSelected = function.trait_on_off.state == "on"
             };
             bottomView.AddChidren(btnWorkSceneControl);
+
+
+            btnWorkSceneControl.MouseUpEventHandler = (sender2, e2) =>
+            {
+                if (function.trait_on_off.state == "off")
+                {
+                    return;
+                }
+                Dialog dialog = new Dialog();
+
+                var dialogView = new FrameLayout();
+                dialog.AddChidren(dialogView);
+                dialogView.MouseUpEventHandler = (sender, e) => {
+                    dialog.Close();
+                };
+
+                var dialogContentView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(194),
+                    Y = Application.GetRealHeight(419),
+                    Width = Application.GetRealWidth(148),
+                    Height = Application.GetRealHeight(191),
+                    BackgroundImagePath = "FunctionIcon/Acst/BgChooseScene.png",
+                };
+                dialogView.AddChidren(dialogContentView);
+
+                var titleView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = Application.GetRealHeight(3),
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(titleView);
+                var btnTitleText = new Button()
+                {
+                    X = Application.GetRealWidth(16),
+                    Width = Application.GetRealWidth(100),
+                    Text = "閫夋嫨鍦烘櫙",
+                    TextSize = 16,
+                    TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                    IsBold = true,
+                    TextAlignment = TextAlignment.CenterLeft,
+                };
+                titleView.AddChidren(btnTitleText);
+
+                #region 鍦ㄥ
+                var atHomeView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = titleView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(atHomeView);
+                atHomeView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton atHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAtHome.png", $"FunctionIcon/Acst/{imageFolder}/SceneAtHome.png",
+                    "鍦ㄥ", curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString());
+                atHomeIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add(AcstParent_AttrEnum.scene.ToString(), AcstParent_Attr_SceneValueEnum.at_home.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                atHomeView.AddChidren(atHomeIconButton);
+                #endregion
+
+
+                #region 绂诲
+                var awayHomeView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = atHomeView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(awayHomeView);
+                awayHomeView.AddChidren(new Button
+                {
+                    Width = Application.GetRealWidth(112),
+                    Gravity = Gravity.CenterHorizontal,
+                    Height = 1,
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton awayHomeIconButton = new IconButton("FunctionIcon/Acst/grey/SceneAwayHomeIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon.png",
+                    "绂诲", curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString());
+                awayHomeIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("scene", "leave_home");
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                awayHomeView.AddChidren(awayHomeIconButton);
+                #endregion 
+
+                #region 鐫$湢
+                var sleepView = new FrameLayout()
+                {
+                    X = Application.GetRealWidth(2),
+                    Y = awayHomeView.Bottom,
+                    Width = Application.GetRealWidth(144),
+                    Height = Application.GetRealHeight(44),
+                };
+                dialogContentView.AddChidren(sleepView);
+                sleepView.AddChidren(new Button
+                {
+                    Height = 1,
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(112),
+                    BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                });
+                IconButton sleepIconButton = new IconButton("FunctionIcon/Acst/grey/SceneSleepIcon.png", $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon.png",
+                    Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString());
+                sleepIconButton.Click(() => {
+                    btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png";
+                    dialog.Close();
+                    new System.Threading.Thread(() => {
+                        Dictionary<string, string> d = new Dictionary<string, string>();
+                        d.Add("scene", "sleep");
+                        Control.Ins.SendWriteCommand(function, d);
+                    })
+                    { IsBackground = true }.Start();
+                });
+                sleepView.AddChidren(sleepIconButton);
+                #endregion 
+                dialog.Show();
+            };
 
 
 
@@ -537,7 +1011,9 @@
 
     }
 
-
+    /// <summary>
+    /// 浼犳劅鍣ㄦ暟鎹粍浠�
+    /// </summary>
     public class SensorDiyView
     {
         private FrameLayout contentView;
@@ -545,11 +1021,19 @@
         private Button btnText;
         public string Tag;
 
-        public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string text)
+        public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string text,int setWidth = 60)
         {
+            if (string.IsNullOrEmpty(value))
+            {
+                value = "--";
+            }
+
+            ///榛樿Tag 涓轰紶杩涙潵鐨凾ext
+            Tag = text;
+
             contentView = new FrameLayout()
             {
-                Width = Application.GetRealWidth(60),
+                Width = Application.GetRealWidth(setWidth),
                 Height = Application.GetRealHeight(72),
             };
             view.AddChidren(contentView);
@@ -582,4 +1066,178 @@
             btnText.Text = value;
         }
     }
+
+    /// <summary>
+    /// 瀛愭帶鍗$墖缁勪欢
+    /// </summary>
+    public class AcstSubControlView
+    {
+        public TextButton btnSubTempValues;
+        public TextButton btnSubHumidityValues;
+        public Button btnSubPower;
+        public string Tag;
+
+        public AcstSubControlView(Function sub, HorizontalScrolViewLayout subFunctionListView,string imageFolder)
+        {
+            Tag = sub.sid;
+
+            var subFunctionView = new FrameLayout()
+            {
+                Width = Application.GetRealWidth(177),
+                Height = Application.GetRealHeight(93),
+                BackgroundImagePath = "FunctionIcon/Acst/grey/BgSubControlView.png",
+            };
+            subFunctionListView.AddChidren(subFunctionView);
+
+            var btnRoomInfo = new Button()
+            {
+                X = Application.GetRealWidth(18 + 7),
+                Y = Application.GetRealHeight(11),
+                Height = Application.GetRealHeight(40),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = 0xFF1b3053,
+                TextSize = 13,
+                Text = sub.GetRoomListName(),
+            };
+            subFunctionView.AddChidren(btnRoomInfo);
+
+            var btnSubTempIcon = new Button()
+            {
+                X = Application.GetRealWidth(16 + 7),
+                Y = Application.GetRealHeight(47 + 11),
+                Width = Application.GetMinRealAverage(11),
+                Height = Application.GetMinRealAverage(11),
+                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacTempIcon.png",
+            };
+            subFunctionView.AddChidren(btnSubTempIcon);
+
+            btnSubTempValues = new TextButton()
+            {
+                X = btnSubTempIcon.Right,
+                Y = Application.GetRealHeight(45 + 11),
+                Height = Application.GetRealHeight(14),
+                Width = Application.GetRealWidth(22),
+                TextColor = 0xFF1b3035,
+                TextSize = 10,
+                Text = sub.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()) + "掳C",
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            subFunctionView.AddChidren(btnSubTempValues);
+
+            Button btnSubHumidityIcon = new Button()
+            {
+                X = btnSubTempValues.Right + Application.GetRealWidth(5),
+                Y = Application.GetRealHeight(47 + 11),
+                Width = Application.GetMinRealAverage(11),
+                Height = Application.GetMinRealAverage(11),
+                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png",
+            };
+            subFunctionView.AddChidren(btnSubHumidityIcon);
+
+            btnSubHumidityValues = new TextButton()
+            {
+                X = btnSubHumidityIcon.Right,
+                Y = Application.GetRealHeight(45 + 11),
+                Height = Application.GetRealHeight(14),
+                Width = Application.GetRealWidth(22),
+                TextColor = 0xFF1b3053,
+                TextSize = 10,
+                Text = sub.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()) + "%",
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            subFunctionView.AddChidren(btnSubHumidityValues);
+
+            btnSubPower = new Button()
+            {
+                X = Application.GetRealWidth(121 + 7),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealWidth(28),
+                UnSelectedImagePath = "FunctionIcon/Acst/grey/PowerOffIcon.png",
+                SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/PowerIcon.png",
+                TextAlignment = TextAlignment.Center,
+            };
+            subFunctionView.AddChidren(btnSubPower);
+            btnSubPower.MouseUpEventHandler = (sender, e) => {
+                btnSubPower.IsSelected = !btnSubPower.IsSelected;
+                string onoff = btnSubPower.IsSelected ? "on" : "off";
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.OnOff, onoff);
+                Control.Ins.SendWriteCommand(sub, d);
+            };
+
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+                var page = new AcstSubPage(sub,imageFolder);
+                MainPage.BasePageView.AddChidren(page);
+                page.LoadPage();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+
+            btnRoomInfo.MouseUpEventHandler = eventHandler;
+            btnSubHumidityIcon.MouseUpEventHandler = eventHandler;
+            btnSubHumidityValues.MouseUpEventHandler = eventHandler;
+            btnSubPower.MouseUpEventHandler = eventHandler;
+            btnSubTempIcon.MouseUpEventHandler = eventHandler;
+            btnSubTempValues.MouseUpEventHandler = eventHandler;
+            subFunctionView.MouseUpEventHandler = eventHandler;
+        }
+    }
+
+
+    public class IconButton : FrameLayout
+    {
+        FrameLayout view;
+
+        public Button btnIcon;
+
+        public Button btnText;
+
+        public IconButton(string iconPath,string iconPath2,string text,uint color,bool isSelect)
+        {
+            view = this;
+            view.Width = Application.GetRealWidth(144);
+            view.Height = Application.GetRealHeight(44);
+
+            btnIcon = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetRealWidth(24),
+                Height = Application.GetRealWidth(24),
+                UnSelectedImagePath = iconPath,
+                SelectedImagePath = iconPath2,
+                IsSelected = isSelect,
+            };
+            view.AddChidren(btnIcon);
+
+            btnText = new Button()
+            {
+                X = Application.GetRealWidth(52),
+                Width = Application.GetRealWidth(90),
+                TextAlignment = TextAlignment.CenterLeft,
+                Text = text,
+                TextSize = 14,
+                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                SelectedTextColor = color,
+                IsSelected = isSelect,
+            };
+            view.AddChidren(btnText);
+
+            
+        }
+
+
+        public void Click(Action action)
+        {
+            view.MouseUpEventHandler = (sender, e) => {
+                action();
+            };
+            btnText.MouseUpEventHandler = (sender, e) => {
+                action();
+            };
+            btnIcon.MouseUpEventHandler = (sender, e) => {
+                action();
+            };
+        }
+    }
 }

--
Gitblit v1.8.0