From 02498f7744e6fdc413e518f96b25f3635540dc6b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 15 十一月 2022 11:27:38 +0800
Subject: [PATCH] 金茂科技系统更新

---
 HDL-ON_Android/Properties/AndroidManifest.xml                      |    2 
 HDL_ON/Common/ApiUtlis.cs                                          |   11 
 HDL_ON/Entity/DB_ResidenceData.cs                                  |   22 -
 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs               |    2 
 HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs                 |  113 ++++++++++
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs            |  116 +++++++----
 HDL_ON/Entity/FunctionList.cs                                      |   20 +
 HDL_ON/UI/UI0-Public/TopViewDiv.cs                                 |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs |  217 ++++++++++++++-------
 HDL_ON/DAL/Server/HttpUtil.cs                                      |    4 
 HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs                |   20 -
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs               |   41 ++--
 HDL_ON/UI/UI1-Login/LoginPage.cs                                   |    8 
 SiriIntents/Server/HttpUtil.cs                                     |    4 
 14 files changed, 379 insertions(+), 203 deletions(-)

diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index ea9ea00..87ace86 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.2" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202211081">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.2" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202211111">
 	<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
 	<!--鍙嬬洘-->
 	<!--<uses-sdk android:minSdkVersion="8"></uses-sdk>-->
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 00f630a..ee2d4f8 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -176,9 +176,9 @@
                             {
                                 endTime = DateTime.Now.AddSeconds(5);
 
-                                MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
-                                MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString());
-                                var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
+                                //MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
+                                //MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString());
+                                var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                 if (deviceList == null)
                                 {
                                     deviceList = new DevcieApiPack();
@@ -190,7 +190,7 @@
                                         var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + "");
                                         if (deviceResult2.Code == StateCode.SUCCESS)
                                         {
-                                            var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
+                                            var deviceList2 = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                             deviceList.pageNo = deviceList2.pageNo;
                                             deviceList.list.AddRange(deviceList2.list);
                                         }
@@ -229,11 +229,13 @@
                                     }
                                 }
                                 //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
+                                int iiii = 0;
                                 foreach (var newFunction in deviceList.list)
                                 {
                                     newFunction.AssembleStatus();
                                     newFunction.SaveFunctionFile();
                                     FunctionList.List.IniFunctionList(newFunction.savePath);
+                                    MainPage.Log($"============璁惧============{iiii++}");
                                 }
                                 endTime = DateTime.Now.AddSeconds(5);
                             }
@@ -248,6 +250,7 @@
                         finally
                         {
                             complateDevice = true;
+                            MainPage.Log($"============璁惧============瀹屾垚");
                         }
                     })
                     { IsBackground = true }.Start();
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index bf39c96..511a91e 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
         /// <summary>
         /// RegionMark
         /// </summary>
diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index d3df31b..f5b747d 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -54,20 +54,19 @@
             }
         }
 
-        [Newtonsoft.Json.JsonIgnore]
-        private List<ShowFunction> showFunctions;
+        private List<ShowFunction> dddd;
 
         /// <summary>
         /// 鍔熻兘绫诲瀷鍒楄〃
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
-        public List<ShowFunction> functionTypeList
+        public List<ShowFunction> ShowFunctionTypeList
         {
             get
             {
-                if (showFunctions == null)
+                if (dddd == null)
                 {
-                    showFunctions = new List<ShowFunction> {
+                    dddd = new List<ShowFunction>(){
                                     ShowFunction.Light,ShowFunction.AC,ShowFunction.Curtain,
                                     ShowFunction.FloorHeating,ShowFunction.Music,
                                     ShowFunction.Electric,ShowFunction.Environmental,
@@ -78,7 +77,7 @@
                                     ShowFunction.SecurityCenter,ShowFunction.Acst,
                                     ShowFunction.MechanicalArm };
                 }
-                return showFunctions;
+                return dddd;
             }
         }
 
@@ -123,17 +122,6 @@
                         {
                             instance = temp;
                         }
-                        instance.functionTypeList.AddRange(new List<ShowFunction> {
-                                    ShowFunction.Light,ShowFunction.AC,ShowFunction.Curtain,
-                                    ShowFunction.FloorHeating,ShowFunction.Music,
-                                    ShowFunction.Electric,ShowFunction.Environmental,
-                                    ShowFunction.EnergyMonitoring,
-                                    ShowFunction.FreshAir,ShowFunction.DoorLock,
-                                    ShowFunction.Panel,ShowFunction.SecurityMonitoring,
-                                    ShowFunction.Sensor,ShowFunction.VideoIntercom,
-                                    ShowFunction.SecurityCenter,ShowFunction.Acst,
-                                    ShowFunction.MechanicalArm
-                                });
                         instance.SupportFacePass = false;
                         instance.SaveResidenceData();
                     }
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 8ca1efc..cdd06aa 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -360,25 +360,33 @@
                 switch (brandType)
                 {
                     case SPK.BrandType.Hdl:
-                        foreach (var function in Functions)
+                        try
                         {
-                            if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+                            foreach (var function in Functions)
                             {
-                                resultFunctions.Add(function);
+                                if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+                                {
+                                    resultFunctions.Add(function);
+                                }
                             }
                         }
+                        catch { }
                         break;
 
                     case SPK.BrandType.Tuya:
                         lock (Functions)
                         {
-                            foreach (var function in Functions)
+                            try
                             {
-                                if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                                foreach (var function in Functions)
                                 {
-                                    resultFunctions.Add(function);
+                                    if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+                                    {
+                                        resultFunctions.Add(function);
+                                    }
                                 }
                             }
+                            catch { }
                         }
                         break;
                 }
diff --git a/HDL_ON/UI/UI0-Public/TopViewDiv.cs b/HDL_ON/UI/UI0-Public/TopViewDiv.cs
index 2d7de2c..7951076 100644
--- a/HDL_ON/UI/UI0-Public/TopViewDiv.cs
+++ b/HDL_ON/UI/UI0-Public/TopViewDiv.cs
@@ -170,7 +170,7 @@
             var btnSetting = new Button()
             {
                 X = Application.GetRealWidth(337-37),
-                Y = Application.GetRealHeight(10),
+                Y = Application.GetRealHeight(20),
                 Width = Application.GetMinRealAverage(28+37),
                 Height = Application.GetMinRealAverage(28+19),
                 TextID = StringId.CombinedDimming,
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index 0f88e47..bcba6a6 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -215,11 +215,9 @@
                     //etAccount.Text = "13226233133";//璞嗚眴
                     //etAccount.Text = "18316120654";//tujie
                     //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰
-                    etAccount.Text = "18244942707";
                     etAccount.Text = "tf@smarttech.com.ua";
-                    etAccount.Text = "13288623489";
                     etAccount.Text = "455740454@qq.com";
-                    etAccount.Text = "13335135632";
+                    etAccount.Text = "18688565449";
                 }
                 else
                 {
@@ -253,9 +251,9 @@
                 }
                 b = !b;
                 etPassword.Text = "123456";
-                if(etAccount.Text == "13335135632")
+                if(etAccount.Text == "18688565449")
                 {
-                    etPassword.Text = "borui1123";
+                    etPassword.Text = "CISQSMJH";
                 }
                 //etPassword.Text = "Hdl85521566";
                 btnLogin.IsSelected = true;
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index 6c21dc8..1bf3b2e 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -649,7 +649,7 @@
             var lastY2 = Application.GetRealWidth(16);
             var functionContentViewHeight = Application.GetRealWidth(16);
 
-            foreach (var item in DB_ResidenceData.Instance.functionTypeList)
+            foreach (var item in DB_ResidenceData.Instance.ShowFunctionTypeList)
             {
                 int functionCount = 0;
                 int functionOnCount = 0;
diff --git a/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
index 5b6e62f..37b83e8 100644
--- a/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
+++ b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
@@ -1,4 +1,7 @@
 锘縰sing System;
+using System.Collections.Generic;
+using System.Threading;
+using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
@@ -77,7 +80,10 @@
                 UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                 IsSelected = scene.collect
             };
-            this.AddChidren(btnCollectionIcon);
+            if (scene.sceneType != SceneType.LightScene)
+            {
+                this.AddChidren(btnCollectionIcon);
+            }
 
             btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
             if (scene.sceneType == SceneType.MovieScene)
@@ -116,14 +122,103 @@
         /// </summary>
         void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, Scene scene)
         {
-            EventHandler<MouseEventArgs> upEvent = (sender, e) => {
-                DriverLayer.Control.Ins.ControlScene(scene);
-                string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
-                new PublicAssmebly().TipMsgAutoClose(msg, false);
-            };
-            btnName.MouseUpEventHandler = upEvent;
-            btnFromFloor.MouseUpEventHandler = upEvent;
-            this.MouseUpEventHandler = upEvent;
+            if (scene.sceneType == SceneType.LightScene)
+            {
+                EventHandler<MouseEventArgs> upEvent = (sender, e) =>
+                {
+                    if (scene.functions.Count == 0)
+                    {
+
+                        var waitPage = new Loading();
+                        new Thread(() =>
+                        {
+                            try
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    MainPage.BaseView.AddChidren(waitPage);
+                                    waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                                });
+                                var pm = new HttpServerRequest();
+                                var pack = pm.GetSceneInfo(scene.userSceneId);
+                                if (pack.Code == StateCode.SUCCESS)
+                                {
+                                    var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
+                                    var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
+                                    if (tempScene != null)
+                                    {
+                                        scene.name = tempScene.name;
+                                        scene.delay = tempScene.delay;
+                                        scene.roomIds = tempScene.roomIds;
+                                        scene.functions = tempScene.functions;
+                                    }
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        var sceneLishtList = new List<Function>();
+                                        foreach (var light in FunctionList.List.GetLightList())
+                                        {
+                                            var temp = scene.functions.Find((obj) => obj.sid == light.sid);
+                                            if (temp != null)
+                                            {
+                                                sceneLishtList.Add(light);
+                                            }
+                                        }
+                                        Action<Scene> action = (Scene) => { };
+                                        var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action);
+                                        lightSceneDialog.ShowDialog();
+
+                                        waitPage.Hide();
+                                        waitPage.RemoveFromParent();
+                                    });
+                                }
+                                else
+                                {
+                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                                }
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    waitPage.Hide();
+                                    waitPage.RemoveFromParent();
+                                });
+                            }
+                        }).Start();
+                    }
+                    else
+                    {
+                        var sceneLishtList = new List<Function>();
+                        foreach (var light in FunctionList.List.GetLightList())
+                        {
+                            var temp = scene.functions.Find((obj) => obj.sid == light.sid);
+                            if (temp != null)
+                            {
+                                sceneLishtList.Add(light);
+                            }
+                        }
+                        Action<Scene> action = (Scene) => { };
+                        var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action);
+                        lightSceneDialog.ShowDialog();
+                    }
+                };
+                btnName.MouseUpEventHandler = upEvent;
+                btnFromFloor.MouseUpEventHandler = upEvent;
+                this.MouseUpEventHandler = upEvent;
+            }
+            else
+            {
+                EventHandler<MouseEventArgs> upEvent = (sender, e) =>
+                {
+                    DriverLayer.Control.Ins.ControlScene(scene);
+                    string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
+                    new PublicAssmebly().TipMsgAutoClose(msg, false);
+                };
+                btnName.MouseUpEventHandler = upEvent;
+                btnFromFloor.MouseUpEventHandler = upEvent;
+                this.MouseUpEventHandler = upEvent;
+            }
         }
 
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs
index c64c35c..d50a49e 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CancelAccountPage.cs
@@ -135,8 +135,9 @@
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = CSS_FontSize.TextFontSize,
                 PlaceholderTextColor = CSS_Color.PromptingColor1,
-                PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber),
+                PlaceholderText = UserInfo.Current.AccountString,// Language.StringByID(StringId.PlsEntryPhoneNumber),
                 TextAlignment = TextAlignment.CenterLeft,
+                Enable = false
             };
             accountView.AddChidren(etAccount);
 
@@ -196,7 +197,7 @@
             var btnLogin = new Button()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(403),
+                Y = Application.GetRealHeight(353),
                 Width = Application.GetRealWidth(220),
                 Height = Application.GetRealWidth(44),
                 Radius = (uint)Application.GetRealWidth(22),
@@ -209,22 +210,9 @@
             };
             bodyView.AddChidren(btnLogin);
 
-            string account = "";
-            etAccount.TextChangeEventHandler = (sender, e) =>
-            {
-                account = etAccount.Text.Trim();
-                if (account.Length > 0 && etPassword.Text.Trim().Length > 0)
-                {
-                    btnLogin.IsSelected = true;
-                }
-                else
-                {
-                    btnLogin.IsSelected = false;
-                }
-            };
             etPassword.TextChangeEventHandler += (sender, e) =>
             {
-                if (etAccount.Text.Trim().Length > 0 && etPassword.Text.Trim().Length > 0)
+                if ( etPassword.Text.Trim().Length > 0)
                 {
                     btnLogin.IsSelected = true;
                 }
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
index cee8a68..714191b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
@@ -16,7 +16,8 @@
     {
         static AcstParentPage basePage;
 
-        VerticalScrolViewLayout bodyView;
+        VerticalScrolViewLayout contentView;
+
 
         #region 澶╂皵鎺т欢
         Button btnOutdoorTemp;
@@ -66,8 +67,10 @@
             basePage = this;
             this.function = FunctionList.List.GetAcstParentList()[0];
             this.BackgroundColor = CSS.CSS_Color.BackgroundColor;
-            bodyView = new VerticalScrolViewLayout();
-            this.AddChidren(bodyView);
+            contentView = new VerticalScrolViewLayout() {
+                Height = Application.GetRealHeight(667 - 56),
+            };
+            this.AddChidren(contentView);
             subViewList = new Dictionary<string, AcstSubControlView>();
         }
         /// <summary>
@@ -232,7 +235,7 @@
                 Height = Application.GetRealHeight(180),
                 BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/TopViewBg.png",
             };
-            bodyView.AddChidren(topView);
+            contentView.AddChidren(topView);
 
             var backView = new FrameLayout()
             {
@@ -353,7 +356,7 @@
 
             #endregion
 
-            bodyView.AddChidren(new Button
+            contentView.AddChidren(new Button
             {
                 Height = Application.GetRealHeight(8),
             });
@@ -417,7 +420,7 @@
                     Height = Application.GetRealHeight(104),
                     BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                 };
-                bodyView.AddChidren(infoView);
+                contentView.AddChidren(infoView);
 
                 var infoContentView = new FrameLayout()
                 {
@@ -442,11 +445,21 @@
 
                 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)
                 {
@@ -536,7 +549,7 @@
             {
                 Height = Application.GetRealHeight(54-11),
             };
-            bodyView.AddChidren(subTitleView);
+            contentView.AddChidren(subTitleView);
 
             var btnCollection = new Button()
             {
@@ -582,42 +595,53 @@
             {
                 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 (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);
+                            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 +1030,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 +1067,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 +1105,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 +1129,11 @@
 
             InitGetWeatherAction();
 
-            Control.Ins.SendReadCommand(function);
+            new System.Threading.Thread(() =>
+            {
+                Control.Ins.SendReadCommand(function);
+            })
+            { IsBackground = true }.Start();
 
         }
 
@@ -1160,10 +1188,14 @@
                 TextAlignment = TextAlignment.Center,
                 TextColor = 0xFF949AA5,
                 TextSize = 12,
-                Text = text + "(" + unitString+")",
+                Text = text ,
             };
             contentView.AddChidren(btnText);
 
+            if(!string.IsNullOrEmpty(unitString))
+            {
+                btnText.Text += "(" + unitString + ")";
+            }
 
 
         }
@@ -1174,7 +1206,7 @@
             {
                 value = value.Remove(value.IndexOf('.'), value.Length - value.IndexOf('.'));
             }
-            btnValue.Text = value + unitString;
+            btnValue.Text = value;
         }
     }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
index 98e5278..f004fbf 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
@@ -47,7 +47,8 @@
 
                 //int progress = 0;
                 //int.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString()), out progress);
-                bodyView.tempBar.Progress = setTempValue - 16;
+                if (bodyView.tempBar.Progress != setTempValue - 16)
+                    bodyView.tempBar.Progress = setTempValue - 16;
                 if(temp.trait_on_off.curValue.ToString() == "on")
                 {
                     bodyView.btnPowerControl.IsSelected = true;
@@ -131,9 +132,9 @@
                 TextSize = 30,
                 TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                 TextAlignment = TextAlignment.TopRight,
-                Text = "---",
+                Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString(),"---"),
             };
-            btnTempValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString());
+            //btnTempValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString());
             btnTempValues.Width = btnTempValues.GetTextWidth();
             btnTempValues.Gravity = Gravity.CenterHorizontal;
             tempValuesView.AddChidren(btnTempValues);
@@ -167,10 +168,9 @@
                 IsBold = true,
                 TextSize = 30,
                 TextColor = CSS.CSS_Color.FirstLevelTitleColor,
-                Text = "---",
+                Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString(),"---"),
                 TextAlignment = TextAlignment.TopRight,
             };
-            btnHumiValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString());
             btnHumiValues.Width = btnTempValues.GetTextWidth();
             btnHumiValues.Gravity = Gravity.CenterHorizontal;
             humiValuesView.AddChidren(btnHumiValues);
@@ -201,25 +201,26 @@
             #endregion
 
 
-            btnSetTempValues = new Button()
-            {
-                X = Application.GetRealWidth((375 - 77 -30)/2),
-                Y = Application.GetRealHeight(260),
-                Width = Application.GetRealWidth(77),
-                Height = Application.GetRealHeight(90),
-                TextAlignment = TextAlignment.TopRight,
-                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
-                IsBold = true,
-                TextSize = 60,
-                Text = function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--")
-            };
-            contentView.AddChidren(btnSetTempValues);
             int setTempValue = 0;
+            string setTempStr = "--";
             double dd = 0;
             double.TryParse(function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out dd);
             setTempValue = Convert.ToInt32(dd);
             if (setTempValue != 0)
-                btnSetTempValues.Text = setTempValue.ToString();
+                setTempStr = setTempValue.ToString();
+            btnSetTempValues = new Button()
+            {
+                X = Application.GetRealWidth((375 - 77 -30)/2),
+                Y = Application.GetRealHeight(260),
+                Width = Application.GetRealWidth(73),
+                Height = Application.GetRealHeight(90),
+                TextAlignment = TextAlignment.TopCenter,
+                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
+                IsBold = true,
+                TextSize = 60,
+                Text = setTempStr
+            };
+            contentView.AddChidren(btnSetTempValues);
             //bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10);
 
 
@@ -267,7 +268,7 @@
                 ThumbImageHeight = Application.GetRealHeight(51),
                 ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? curColor : CSS_Color.DividingLineColor,
                 MaxValue = 14,
-                Progress = progress + 16,
+                Progress = progress - 16,
                 SeekBarPadding = Application.GetRealWidth(20),
                 IsProgressTextShow = false,
                 ProgressChangeDelayTime = 0,
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
index 03ed12d..ee30315 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -342,6 +342,14 @@
     /// </summary>
     public class LightSceneEditDialog :Dialog
     {
+
+
+        Dictionary<string, string> d = new Dictionary<string, string>();
+        List<Function> listSwitch = new List<Function>();
+        List<Function> lightDimming = new List<Function>();
+        List<Function> lightCCT = new List<Function>();
+        List<Function> lightRGB = new List<Function>();
+
         /// <summary>
         /// 浼犲叆鐨勭伅鍏夊垪琛�
         /// 鍔犲叆鍦烘櫙鎺у埗鍔熻兘鍒楄〃
@@ -369,9 +377,14 @@
         {
             commandDic.Add(FunctionAttributeKey.OnOff, "off");
 
-            var hadDimming = lights.Find((obj) => obj.spk == SPK.LightDimming) != null;
-            var hadCCT = lights.Find((obj) => obj.spk == SPK.LightCCT) != null;
-            var hadRGB = lights.Find((obj) => obj.spk == SPK.LightRGB) != null;
+            listSwitch = lights.FindAll((obj) => obj.spk == SPK.LightSwitch);
+            lightDimming = lights.FindAll((obj) => obj.spk == SPK.LightDimming);
+            lightCCT = lights.FindAll((obj) => obj.spk == SPK.LightCCT);
+            lightRGB = lights.FindAll((obj) => obj.spk == SPK.LightRGB);
+
+            var hadDimming = lightDimming.Count > 0;
+            var hadCCT = lightCCT.Count > 0;
+            var hadRGB = lightRGB.Count > 0;
 
             var bodyView = new FrameLayout();
             this.AddChidren(bodyView);
@@ -426,7 +439,7 @@
             };
             titleView.AddChidren(btnEditIcon);
 
-                Action<string> callBack = (str) =>
+            Action<string> callBack = (str) =>
                 {
                     //鍚嶇О涓嶈兘涓虹┖
                     if (string.IsNullOrEmpty(str))
@@ -479,19 +492,19 @@
 
             var brightnessValue = 0;
             var cctValue = 27;
-            if(rgbLight!= null)
-            {
-                int.TryParse(rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
-            }
-            if (cctLight != null)
-            {
-                int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
-                int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
-            }
-            if(dimmingLight!=null)
-            {
-                int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
-            }
+            //if(rgbLight!= null)
+            //{
+            //    int.TryParse(rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
+            //}
+            //if (cctLight != null)
+            //{
+            //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
+            //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
+            //}
+            //if(dimmingLight!=null)
+            //{
+            //    int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out brightnessValue);
+            //}
 
 
             //灞炴�ц缃尯鍩�
@@ -561,12 +574,24 @@
                     btnClose.IsSelected = true;
                     btnOpen.IsSelected = false;
                     commandDic[FunctionAttributeKey.OnOff] = "off";
+                    d.Clear();
+                    d.Add(FunctionAttributeKey.OnOff, "off");
+                    foreach (var light in lights)
+                    {
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
                 };
                 btnOpen.MouseUpEventHandler = (sender, e) =>
                 {
                     btnClose.IsSelected = false;
                     btnOpen.IsSelected = true;
                     commandDic[FunctionAttributeKey.OnOff] = "on";
+                    d.Clear();
+                    d.Add(FunctionAttributeKey.OnOff, "on");
+                    foreach (var light in lights)
+                    {
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
                 };
 
             }
@@ -621,18 +646,18 @@
             contentView.AddChidren(bottomView);
             bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
 
-            var btnSave = new Button()
+            var btnCacel = new Button()
             {
                 Width = Application.GetRealWidth(172),
                 Height = Application.GetRealHeight(44),
                 TextAlignment = TextAlignment.Center,
                 TextSize = CSS_FontSize.SubheadingFontSize,
                 TextColor = CSS_Color.TextualColor,
-                TextID = StringId.Save,
+                TextID = StringId.Cancel,
             };
-            bottomView.AddChidren(btnSave);
+            bottomView.AddChidren(btnCacel);
 
-            var btnComplete = new Button()
+            var btnSave = new Button()
             {
                 X = Application.GetRealWidth(172),
                 Width = Application.GetRealWidth(172),
@@ -641,76 +666,75 @@
                 TextColor = CSS_Color.MainBackgroundColor,
                 TextAlignment = TextAlignment.Center,
                 TextSize = CSS_FontSize.SubheadingFontSize,
-                Text = "鎵ц"
+                TextID = StringId.Save
             };
-            bottomView.AddChidren(btnComplete);
+            bottomView.AddChidren(btnSave);
 
             //渚嬶細鍙充笅鍦嗚 澶у皬涓�50
             int mRectCornerID = HDLUtils.RectCornerBottomRight;
-            btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
+            btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
 
 
 
-            btnComplete.MouseUpEventHandler = (sender, e) => {
-                //this.Close();
+            btnCacel.MouseUpEventHandler = (sender, e) => {
+                this.Close();
 
-                var waitPage = new Loading();
-                MainPage.BaseView.AddChidren(waitPage);
-                waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                //var waitPage = new Loading();
+                //MainPage.BaseView.AddChidren(waitPage);
+                //waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                //new Thread(() =>
+                //{
+                //    try
+                //    {
+                //        foreach (var light in lights)
+                //        {
+                //            Dictionary<string, string> sendDate = new Dictionary<string, string>();
+                //            //璧嬪�煎満鏅姛鑳芥暟鎹�
+                //            foreach (var attr in light.GetAttributes())
+                //            {
+                //                if (commandDic.ContainsKey(attr))
+                //                {
+                //                    try
+                //                    {
+                //                        sendDate.Add(attr, commandDic[attr]);
+                //                    }
+                //                    catch { }
+                //                }
 
-                new Thread(() =>
-                {
-                    try
-                    {
-                        foreach (var light in lights)
-                        {
-                            Dictionary<string, string> sendDate = new Dictionary<string, string>();
-                            //璧嬪�煎満鏅姛鑳芥暟鎹�
-                            foreach (var attr in light.GetAttributes())
-                            {
-                                if (commandDic.ContainsKey(attr))
-                                {
-                                    try
-                                    {
-                                        sendDate.Add(attr, commandDic[attr]);
-                                    }
-                                    catch { }
-                                }
-
-                            }
-                                Control.Ins.SendWriteCommand(light, sendDate);
-                            Thread.Sleep(50);
-                        }
-                    }
-                    catch
-                    { }
-                    finally
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            waitPage.Hide();
-                            new PublicAssmebly().TipMsgAutoClose("缁勫悎鎺у埗宸叉墽琛�", true);
-                            if (waitPage != null)
-                            {
-                                //backAction(null);
-                                waitPage.RemoveFromParent();
-                            }
-                        });
-                    }
-                })
-                { IsBackground = true }.Start();
+                //            }
+                //                Control.Ins.SendWriteCommand(light, sendDate);
+                //            Thread.Sleep(50);
+                //        }
+                //    }
+                //    catch
+                //    { }
+                //    finally
+                //    {
+                //        Application.RunOnMainThread(() =>
+                //        {
+                //            waitPage.Hide();
+                //            new PublicAssmebly().TipMsgAutoClose("缁勫悎鎺у埗宸叉墽琛�", true);
+                //            if (waitPage != null)
+                //            {
+                //                //backAction(null);
+                //                waitPage.RemoveFromParent();
+                //            }
+                //        });
+                //    }
+                //})
+                //{ IsBackground = true }.Start();
             };
 
 
 
-            btnSave.MouseUpEventHandler += (sender, e) =>
+            btnSave.MouseUpEventHandler = (sender, e) =>
             {
                 if (string.IsNullOrEmpty(scene.name))
                 {
                     new Tip()
                     {
                         CloseTime = 1,
-                        Text = Language.StringByID(StringId.SceneNameCannotBeEmpty),
+                        Text = Language.StringByID(StringId.NameCannotBeEmpty),
                         Direction = AMPopTipDirection.None,
                     }.Show(bodyView);
                     return;
@@ -719,7 +743,7 @@
                 {
                     if (scene.name == tempRoom.name)
                     {
-                        new PublicAssmebly().TipMsg(StringId.Tip, StringId.SceneNameAlreadyExists);
+                        new PublicAssmebly().TipMsg(StringId.Tip, StringId.NameAlreadyExists);
                         return;
                     }
                 }
@@ -765,14 +789,17 @@
                         {
                             if (result == StateCode.SUCCESS)
                             {
-                                scene = serverScene;
+                                scene.userSceneId = serverScene.userSceneId;
                                 FunctionList.List.scenes.Add(scene);
-                                backAction(scene);
+                                backAction?.Invoke(scene);
                                 this.Close();
                             }
                             else
                             {
-                                IMessageCommon.Current.ShowErrorInfoAlter(result);
+                                if (result == "124005")
+                                    IMessageCommon.Current.ShowErrorInfoAlter(Language.StringByID(StringId.GatewayOffline));
+                                else
+                                    IMessageCommon.Current.ShowErrorInfoAlter(result);
                             }
                         });
                     }
@@ -869,6 +896,22 @@
             dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
                 commandDic[FunctionAttributeKey.Percent] = dimmerBar.Progress.ToString();
                 btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
+                
+                foreach (var light in lights)
+                {
+                    if (light.spk == SPK.LightSwitch)
+                    {
+                        d.Clear();
+                        d.Add(FunctionAttributeKey.OnOff, e > 0 ? "on" : "off");
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
+                    else
+                    {
+                        d.Clear();
+                        d.Add(FunctionAttributeKey.Brightness, e.ToString());
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
+                }
             };
 
 
@@ -970,6 +1013,16 @@
             barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
             {
                 commandDic[FunctionAttributeKey.CCT] = (barColorTemplatrue.Progress*100).ToString();
+
+                d.Clear();
+                d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+                foreach (var light in lightCCT)
+                {
+                    if (light.spk == SPK.LightCCT)
+                    {
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
+                }
             };
             //鍙樻洿鑳屾櫙鍥剧殑Y杞村潗鏍�
             btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
@@ -1054,7 +1107,17 @@
             //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�)
             int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
 
-
+            colorPicker.MouseUpEventHandler = (sender2, e) => {
+                d.Clear();
+                d.Add(FunctionAttributeKey.RGB, commandDic[FunctionAttributeKey.RGB]);
+                foreach (var light in lightCCT)
+                {
+                    if (light.spk == SPK.LightCCT)
+                    {
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
+                }
+            };
             colorPicker.ColorChaged += (sender2, e2) => {
                 string rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
                 commandDic[FunctionAttributeKey.RGB] = rgbString;
diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs
index 56a78a0..f61de04 100644
--- a/SiriIntents/Server/HttpUtil.cs
+++ b/SiriIntents/Server/HttpUtil.cs
@@ -16,8 +16,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
         /// <summary>
         /// RegionMark
         /// </summary>

--
Gitblit v1.8.0