From 58beee272e47fdbf814e0c8fe625e09c5b844d4d Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 23 十二月 2020 13:38:27 +0800
Subject: [PATCH] Merge branch 'NewFilePath' into CJL

---
 HDL-ON_Android/Assets/Language.ini                                  |    4 
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs         |  130 ++++----
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs                  |   42 ++
 HDL_ON/Common/ApiUtlis.cs                                           |   66 ++++
 HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs            |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs             |   66 ++--
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs                             |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs      |   95 +++---
 HDL-ON_iOS/Resources/Language.ini                                   |    2 
 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs   |    2 
 HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs                    |    2 
 HDL_ON/DAL/DriverLayer/Control.cs                                   |    6 
 HDL_ON/UI/MainPage.cs                                               |   22 -
 HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs            |   53 +-
 HDL_ON/Entity/Function/Scene.cs                                     |   34 +
 HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs    |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs                |   68 ++--
 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs             |   45 --
 HDL_ON/UI/UI1-Login/LoginPageBLL.cs                                 |    4 
 HDL_ON/Entity/DB_ResidenceData.cs                                   |    2 
 HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs     |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs              |    2 
 HDL_ON/Entity/FunctionList.cs                                       |   42 ++
 HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs           |    2 
 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs        |    2 
 HDL_ON/UI/BindingResidence/BindingResidencePage.cs                  |    2 
 HDL_ON/DAL/Server/NewAPI.cs                                         |    6 
 HDL_ON/Entity/Function/Function.cs                                  |   72 ++++
 HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs                      |    2 
 HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs               |    0 
 HDL_ON/DAL/Server/HttpServerRequest.cs                              |   34 ++
 HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs |    2 
 32 files changed, 503 insertions(+), 314 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 344421e..096fae2 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -123,7 +123,7 @@
 101=宸插垎閰�
 102=鎴块棿宸茬粡瀛樺湪锛屾坊鍔犲け璐ャ��
 103=鏄惁瑕佸垹闄よ鎴块棿?
-104=鍙樺寲閫熷害
+104=鍙樺寲鏃堕棿
 105=瀹ゅ唴娓╁害
 106=绌鸿皟
 107=鍙瀵硅
@@ -349,7 +349,7 @@
 327=鎹曡幏鍦烘櫙
 328=鐢靛奖鍦烘櫙
 329=鏅��
-330=鏃堕棿妯″紡
+330=鑷姩妯″紡
 331=鍔熺巼鍦扮儹
 332=鍦板喎
 333=鍔熺巼鍦板喎
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 791eae6..096fae2 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -123,7 +123,7 @@
 101=宸插垎閰�
 102=鎴块棿宸茬粡瀛樺湪锛屾坊鍔犲け璐ャ��
 103=鏄惁瑕佸垹闄よ鎴块棿?
-104=鍙樺寲閫熷害
+104=鍙樺寲鏃堕棿
 105=瀹ゅ唴娓╁害
 106=绌鸿皟
 107=鍙瀵硅
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index c564f63..24eac42 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -55,7 +55,7 @@
             return result;
         }
 
-        public bool DownloadDataComplete = false;
+        public bool DownloadDataComplete = true;
         /// <summary>
         /// 涓嬭浇鏁版嵁
         /// </summary>
@@ -63,19 +63,25 @@
         {
             if (MainPage.InternetStatus == 0)
                 return;
+            //绾跨▼寮�濮嬫椂闂�
+            var endTime = DateTime.Now.AddSeconds(6);
+
+            MainPage.Log($"寮�濮嬪悓姝ヤ簯绔暟鎹�");
 
             DownloadDataComplete = false;
 
             var waitPage = new Loading();
             MainPage.BaseView.AddChidren(waitPage);
-            waitPage.Start();
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
 
             string code = StateCode.SUCCESS;
 
-            new System.Threading.Thread(() => {
+            var downloadDataThread = new System.Threading.Thread(() =>
+            {
+                MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼");
                 //===================鍒锋柊Token=======================
                 code = Ins.HttpRequest.RefreshToken();
-                if(code != StateCode.SUCCESS)
+                if (code != StateCode.SUCCESS)
                 {
                     MainPage.Log($"鍒锋柊token澶辫触");
                     return;
@@ -191,7 +197,7 @@
                     var pack = Ins.HttpRequest.GetSceneList();
                     if (pack.Code == StateCode.SUCCESS)
                     {
-                        MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛");//:\r\n{pack.Data.ToString()}");
+                        MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛");
                         var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                         if (sceneList != null)
                         {
@@ -237,18 +243,64 @@
 
                     //===================璇诲彇閫昏緫鍒楄〃==========================
                     UI.UI2.Intelligence.Automation.MainView.GetLogicList();
-                }catch(Exception ex)
+                }
+                catch (Exception ex)
                 {
                     MainPage.Log($"鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}");
                 }
                 finally
                 {
-                    Application.RunOnMainThread(() => {
+                    Application.RunOnMainThread(() =>
+                    {
+                        MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼");
+                        endTime = DateTime.MinValue;
                         DownloadDataComplete = true;
                         waitPage.Hide();
                         waitPage.RemoveFromParent();
                     });
                 }
+            });
+            downloadDataThread.IsBackground = true;
+            downloadDataThread.Priority = System.Threading.ThreadPriority.Highest;
+            downloadDataThread.Start();
+
+            //缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋�
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    while (endTime > DateTime.Now)
+                    {
+                        if (DownloadDataComplete)
+                        {
+                            break;
+                        }
+                        System.Threading.Thread.Sleep(100);
+                    }
+                    if (!DownloadDataComplete)
+                    {
+                        //downloadDataThread.Abort();
+                    }
+                    DownloadDataComplete = true;
+                    Application.RunOnMainThread(() =>
+                    {
+                        waitPage.Hide();
+                        waitPage.RemoveFromParent();
+                    });
+                    //鍒濆鍖栨暟鎹�
+                    //SpatialInfo.CurrentSpatial.Clear();
+
+                }
+                catch { }
+                finally
+                {
+                    #region 璇诲彇鏈湴鏁版嵁
+                    //璇诲彇闊充箰淇℃伅
+                    UI.Music.A31MusicModel.ReadMusicStates();
+                    //鎼滅储缃戝叧
+                    DriverLayer.Control.Ins.SearchLoaclGateway();
+                    #endregion
+                }
             })
             { IsBackground = true }.Start();
         }
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index d6da0f6..8546d1d 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -241,7 +241,11 @@
         {
             if (Ins.IsRemote || DB_ResidenceData.Instance.GatewayType == 1)
             {
-                ControlAProtocolScene(scene);
+                new System.Threading.Thread(() =>
+                {
+                    ControlAProtocolScene(scene);
+                })
+                { IsBackground = true }.Start();
             }
             else
             {
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 490f401..19c8c8a 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -503,7 +503,7 @@
                                 UserInfo.Current.SaveUserInfo();
                                 Action action = () =>
                                 {
-                                    MainPage.GoUserPage();
+                                    MainPage.GoUserPage(true);
                                 };
                                 new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action);
                             });
@@ -553,11 +553,11 @@
         /// <summary>
         /// 鑾峰彇鍒锋柊褰撳墠浣忓畢鐨勭綉鍏冲垪琛�
         /// </summary>
-        public void GetHomeGatewayList()
+        public string GetHomeGatewayList()
         {
             try
             {
-                if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return;
+                if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return "";
                 var nowhomeId = DB_ResidenceData.Instance.CurrentRegion.RegionID;
                 var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = nowhomeId });
                 var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson);
@@ -571,7 +571,7 @@
                             if (mHomeGatewayRes.Count > 0)
                             {
                                 DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
-                                if(mHomeGatewayRes[0].gatewayStatus)
+                                if (mHomeGatewayRes[0].gatewayStatus)
                                 {
                                     //DriverLayer.Control.Ins.IsRemote = true;
                                     DriverLayer.Control.Ins.GatewayOnline = true;
@@ -581,7 +581,7 @@
                                     DriverLayer.Control.Ins.GatewayOnline = false;
                                 }
                                 DB_ResidenceData.Instance.SaveResidenceData();
-                                return;
+                                return revertObj.Code;
                             }
                         }
                         //鍏朵綑鎯呭喌娓呯┖缃戝叧淇℃伅
@@ -593,12 +593,34 @@
                 {
                     //鎻愮ず閿欒
                 }
+                return revertObj.Code;
             }
             catch
             {
-
+                return "";
             }
         }
+        /// <summary>
+        /// 鑾峰彇缃戝叧淇℃伅
+        /// </summary>
+        public string GetGatewayInfo()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+            var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGatewayInfo, jsonString);
+            if (revertObj.Code == StateCode.SUCCESS)
+            {
+                var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString());
+                if (mHomeGatewayRes != null)
+                {
+                    DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes;
+                    DB_ResidenceData.Instance.SaveResidenceData();
+                }
+            }
+            return revertObj.Code;
+        }
 
         /// <summary>
         /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index efdd854..8e13686 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -166,6 +166,10 @@
         /// 鑾峰彇浣忓畢缃戝叧鍒嗛〉
         /// </summary>
         public const string API_POST_GetGatewayList = "/home-wisdom/app/gateway/getGatewayList";
+        /// <summary>
+        /// 鑾峰彇缃戝叧淇℃伅
+        /// </summary>
+        public const string Api_Post_GetGatewayInfo = "/home-wisdom/app/gateway/info";
         ///// <summary>
         ///// 瑙g粦缁戠綉鍏冲埌浣忓畢
         ///// </summary>
@@ -387,7 +391,7 @@
         /// <summary>
         /// 鍙栨秷鏀惰棌鍦烘櫙
         /// </summary>
-        public const string Api_Post_CancelCollectScene = "/home-wisdom/app/scene/cancelcollect";
+        public const string Api_Post_CancelCollectScene = "/home-wisdom/app/scene/cancelCollect";
         #endregion
 
         #region Kaede -- 鎴块棿鎺ュ彛____________________________
diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index 4bf0780..81306ec 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -121,6 +121,8 @@
             instance = null;
             ins_OidList = null;
             HomeGateway = null;
+            //閲嶇疆缃戝叧鐘舵��
+            DriverLayer.Control.Ins.GatewayOnline = false;
             SpatialInfo.CurrentSpatial.Clear();
             FunctionList.List.Clear();
             
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 8e666a9..a41d3d2 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -1,5 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Common;
+using HDL_ON.DAL.Server;
 using HDL_ON.DriverLayer;
 using Shared;
 
@@ -207,6 +209,66 @@
         /// </summary>
         public int fixedSerialNumber = int.MaxValue;
 
+        /// <summary>
+        /// 鏀惰棌鍔熻兘
+        /// </summary>
+        public void CollectFunction()
+        {
+            var result = "";
+            //var waitPage = new Loading();
+
+            new System.Threading.Thread(() =>
+            {
+                if (collect)
+                {
+                    result = ApiUtlis.Ins.HttpRequest.CollectDevice(deviceId).Code;
+                }
+                else
+                {
+                    result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code;
+                }
+                //鎻愮ず閿欒
+                if (result != StateCode.SUCCESS)
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        collect = !collect;
+                        IMessageCommon.Current.ShowErrorInfoAlter(result);
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+        /// <summary>
+        /// 缂栬緫鍔熻兘缁戝畾鎴块棿淇℃伅
+        /// </summary>
+        public void EditBindRoomInfo(string roomId)
+        {
+            var result = "";
+
+            new System.Threading.Thread(() =>
+            {
+                if (collect)
+                {
+                    result = ApiUtlis.Ins.HttpRequest.BindDeviceToRoom(new List<string>() { deviceId }, new List<string>() { roomId }).Code;
+                }
+                else
+                {
+                    result = ApiUtlis.Ins.HttpRequest.UnbindDeviceToRoom(deviceId,roomId);
+                }
+                //鎻愮ず閿欒
+                if (result != StateCode.SUCCESS)
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        collect = !collect;
+                        IMessageCommon.Current.ShowErrorInfoAlter(result);
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
         public string GetBusId()
         {
             string busId = "";
@@ -261,22 +323,22 @@
         {
             if (upSevser)
             {
-                var pm = new DAL.Server.HttpServerRequest();
+                var pm = new HttpServerRequest();
                 var pack = pm.UpdataDevcieInfo(this);
-                if (pack.Code == DAL.Server.StateCode.SUCCESS)
+                if (pack.Code == StateCode.SUCCESS)
                 {
                     var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
-                    Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+                    FileUtlis.Files.WriteFileByBytes(savePath, ssd);
                 }
                 else
                 {
-                    Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code);
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                 }
             }
             else
             {
                 var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
-                Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+                FileUtlis.Files.WriteFileByBytes(savePath, ssd);
             }
         }
 
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index a369fa7..fef4381 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Common;
 using HDL_ON.DAL.Server;
 using Shared;
 
@@ -279,19 +280,30 @@
         /// 鏀惰棌鍦烘櫙
         /// </summary>
         /// <returns></returns>
-        public string CollectScene()
+        public void CollectScene()
         {
-            var pm = new HttpServerRequest();
-            if (this.collect)
+            var result = StateCode.SUCCESS;
+            new System.Threading.Thread(() =>
             {
-                var revPack = pm.CollectScene(this.userSceneId);
-                return revPack;
-            }
-            else
-            {
-                var revPack = pm.CancelCollectScene(this.userSceneId);
-                return revPack;
-            }
+                if (collect)
+                {
+                    result = ApiUtlis.Ins.HttpRequest.CollectScene(userSceneId);
+                }
+                else
+                {
+                    result = ApiUtlis.Ins.HttpRequest.CancelCollectScene(userSceneId);
+                }
+                //鎻愮ず閿欒
+                if (result != StateCode.SUCCESS)
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        collect = !collect;
+                        IMessageCommon.Current.ShowErrorInfoAlter(result);
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
         }
 
         /// <summary>
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index aaacb3c..7adfaaf 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
+using HDL_ON.Common;
 using HDL_ON.DAL;
 using HDL_ON.DAL.Server;
 using Shared;
@@ -371,7 +372,7 @@
             }
             else
             {
-                Utlis.ShowTip(Shared.Language.StringByID(StringId.EditFunctionInfoFail) + "\r\nCode:" + pack.Code);
+                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
             }
             return pack.Code;
         }
@@ -647,7 +648,7 @@
         /// <summary>
         /// 娣诲姞鍦烘櫙
         /// </summary>
-        public string AddScene(Scene scene,out Scene result)
+        public string AddScene(Scene scene, out Scene result)
         {
             Scene tempScene = null;
             var pm = new HttpServerRequest();
@@ -657,13 +658,46 @@
                 var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
                 tempScene = sceneList.Find((obj) => obj.sid == scene.sid);
                 var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene));
-                Common.FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd);
+                FileUtlis.Files.WriteFileByBytes(scene.savePath, ssd);
+                result = tempScene;
             }
-            result = tempScene;
+            else
+            {
+                result = tempScene;
+            }
             return revPack.Code;
         }
         #endregion
 
+        #region 鏀惰棌鍔熻兘
+     
+        /// <summary>
+        /// 鏀惰棌鍦烘櫙
+        /// </summary>
+        public string CollectScene(Scene scene)
+        {
+            var result = "";
+            if (scene.collect)
+            {
+                result = ApiUtlis.Ins.HttpRequest.CollectDevice(scene.userSceneId).Code;
+            }
+            else
+            {
+                result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(scene.userSceneId).Code;
+            }
+
+            //鎻愮ず閿欒
+            if (result != StateCode.SUCCESS)
+            {
+                IMessageCommon.Current.ShowErrorInfoAlter(result);
+            }
+
+            return result;
+        }
+
+        #endregion 
+
+
         #region 鍔熻兘鏂囨湰鐩稿叧
         /// <summary>
         /// 灞炴�у悕绉版樉绀烘枃鏈�
diff --git a/HDL_ON/UI/BindingResidence/BindingResidencePage.cs b/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
index 16d9fdb..601d6d5 100644
--- a/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
+++ b/HDL_ON/UI/BindingResidence/BindingResidencePage.cs
@@ -126,7 +126,7 @@
                 //璋冪敤On鍘熸潵鐨勬柟娉�,鍒锋柊浣忓畢鍒楄〃鍙婂叾缂撳瓨
                 pm.GetHomePager();
                 //璺宠浆椤甸潰----
-                MainPage.GoUserPage(false, () =>
+                MainPage.GoUserPage(true, false, () =>
                 {
                     //鏄剧ず娆㈣繋鍥炲鐨勫脊绐楃晫闈�
                     var form = new WellcomToHomeForm();
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 14fe9bd..c58e805 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -119,7 +119,7 @@
                         //{ IsBackground = true }.Start();
                         Common.ApiUtlis.Ins.DownloadData();
 
-                        GoUserPage(true);
+                        GoUserPage(false,true);
                     }
                 }
             }
@@ -153,7 +153,7 @@
         /// </summary>
         /// <param name="isFirstOpen">濡傛灉鏄涓�娆″惎鍔� 妫�娴嬫牎楠屽瘑鐮�</param>
         /// <param name="pageShowEvent">涓婚〉鏄剧ず涔嬪悗瑙﹀彂鐨勪簨浠�(娌℃湁浣忓畢鐨勮瘽,鍒欎笉浼氳Е鍙�)</param>
-        public static void GoUserPage(bool isFirstOpen = false, Action pageShowEvent = null)
+        public static void GoUserPage(bool downloadData , bool isFirstOpen = false, Action pageShowEvent = null)
         {
             //鍔犺浇Loading鏁堟灉
             var waitPage = new Loading();
@@ -227,11 +227,11 @@
                     MainPage.Log($"GoUserPage : {ex.Message}");
                 }finally
                 {
-                    Application.RunOnMainThread(() =>
-                    {
-                        ///鍒濆鍖朼pp鏁版嵁
-                        InitializationData();
-                    });
+                    //Application.RunOnMainThread(() =>
+                    //{
+                    //    ///鍒濆鍖朼pp鏁版嵁
+                    //    Common.ApiUtlis.Ins.DownloadData();
+                    //});
                 }
             }).Start();
         }
@@ -239,7 +239,7 @@
         /// <summary>
         /// 鍒濆鍖朼pp鎵�闇�瑕佺殑鏁版嵁
         /// </summary>
-        public static void InitializationData()
+        public static void InitializationData1()
         {
             //new System.Threading.Thread(() =>
             //{
@@ -276,12 +276,6 @@
             //})
             //{ IsBackground = true }.Start();
 
-            #region 璇诲彇鏈湴鏁版嵁
-            //璇诲彇闊充箰淇℃伅
-            UI.Music.A31MusicModel.ReadMusicStates();
-            //鎼滅储缃戝叧
-            DriverLayer.Control.Ins.SearchLoaclGateway();
-            #endregion
         }
 
         /// <summary>
diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
index cd43eee..942557a 100644
--- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -598,7 +598,7 @@
                             if (verAccount == etPassword.Text.Trim())
                             {
                                 //璺宠浆椤甸潰----
-                                MainPage.GoUserPage();
+                                MainPage.GoUserPage(true);
                                 return;
                             }
                         });
@@ -630,7 +630,7 @@
                             Application.RunOnMainThread(() =>
                             {
                                 //璺宠浆椤甸潰----
-                                MainPage.GoUserPage();
+                                MainPage.GoUserPage(true);
                             });
                         }
                         else
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index daf89de..de323c9 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -98,7 +98,7 @@
                 }
                 string msg = function.name + Language.StringByID(StringId.CollectionCancelled);
                 LoadDeviceFunctionControlZone();
-                function.SaveFunctionData(true);
+                function.CollectFunction();
                 new PublicAssmebly().TipMsgAutoClose(msg, true);
             };
         }
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 4029e1b..3d80e11 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -66,7 +66,7 @@
             btnCollectionIcon.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollectionIcon.IsSelected = function.collect = !btnCollectionIcon.IsSelected;
-                function.SaveFunctionData(true);
+                function.CollectFunction();
             };
         }
 
@@ -139,32 +139,33 @@
                     Control.Ins.SendWriteCommand(light, d);
                 };
                 dimmerControlBar.OnProgressChangedEvent = (sender, e) => {
-                    light.brightness = e;
-                    light.trait_on_off.curValue = e > 0 ? "on" : "off";
+                    dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
+                    //light.brightness = e;
+                    //light.trait_on_off.curValue = e > 0 ? "on" : "off";
 
-                    if (e == 0 || e == 100)
-                    {
-                        //Control.Send(CommandType_A.write, light);
-                        System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                        d.Add("brightness", light.brightness.ToString());
-                        Control.Ins.SendWriteCommand(light, d);
-                    }
-                    else
-                    {
-                        var tm = (DateTime.Now - light.refreshTime).TotalMilliseconds;
-                        Console.WriteLine("skip time "+tm);
-                        if (300 < tm)
-                        {
-                            light.refreshTime = DateTime.Now;
-                            new System.Threading.Thread(() =>
-                            {
-                                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                                d.Add("brightness", light.brightness.ToString());
-                                Control.Ins.SendWriteCommand(light, d);
-                            })
-                            { IsBackground = true }.Start();
-                        }
-                    }
+                    //if (e == 0 || e == 100)
+                    //{
+                    //    //Control.Send(CommandType_A.write, light);
+                    //    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                    //    d.Add("brightness", light.brightness.ToString());
+                    //    Control.Ins.SendWriteCommand(light, d);
+                    //}
+                    //else
+                    //{
+                    //    var tm = (DateTime.Now - light.refreshTime).TotalMilliseconds;
+                    //    Console.WriteLine("skip time "+tm);
+                    //    if (300 < tm)
+                    //    {
+                    //        light.refreshTime = DateTime.Now;
+                    //        new System.Threading.Thread(() =>
+                    //        {
+                    //            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                    //            d.Add("brightness", light.brightness.ToString());
+                    //            Control.Ins.SendWriteCommand(light, d);
+                    //        })
+                    //        { IsBackground = true }.Start();
+                    //    }
+                    //}
                 };
             }
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
index 454370b..06c8951 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -823,17 +823,39 @@
                         return;
                     }
                 }
-                var result = FunctionList.List.AddScene(scene,out scene);
-                if (result == StateCode.SUCCESS)
+                var waitPage = new Loading();
+                MainPage.BaseView.AddChidren(waitPage);
+                waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                new System.Threading.Thread(() =>
                 {
-                    FunctionList.List.scenes.Add(scene);
-                    backAction();
-                    RemoveFromParent();
-                }
-                else
-                {
-                    IMessageCommon.Current.ShowErrorInfoAlter(result);
-                }
+                    try
+                    {
+                        var serverScene = new Scene();
+                        var result = FunctionList.List.AddScene(scene, out serverScene);
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (result == StateCode.SUCCESS)
+                            {
+                                FunctionList.List.scenes.Add(scene);
+                                backAction();
+                                RemoveFromParent();
+                            }
+                            else
+                            {
+                                IMessageCommon.Current.ShowErrorInfoAlter(result);
+                            }
+                        });
+                    }
+                    catch { }
+                    finally
+                    {
+                        Application.RunOnMainThread(() => {
+                            waitPage.Hide();
+                            waitPage.RemoveFromParent();
+                        });
+                    }
+                })
+                { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs
index d133c7a..e666d72 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/MyQRCodePage.cs
@@ -156,7 +156,7 @@
                         Application.RunOnMainThread(() =>
                         {
                             //璺宠浆椤甸潰----
-                            MainPage.GoUserPage(false, () =>
+                            MainPage.GoUserPage(true, false, () =>
                             {
                                 //鏄剧ず娆㈣繋鍥炲鐨勫脊绐楃晫闈�
                                 var form = new WellcomToHomeForm();
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
old mode 100755
new mode 100644
index 331e653..f70d227
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -186,47 +186,10 @@
             }
             DB_ResidenceData.Instance.CurrentRegion = homeTemp;
             DB_ResidenceData.Instance.SaveResidenceData();
-            var waitPage = new Loading();
-            bodyView.AddChidren(waitPage);
-            waitPage.Start(Language.StringByID(StringId.PleaseWait));
-            new System.Threading.Thread(() =>
-            {
-                try
-                {
-                    DB_ResidenceData.Instance.EixtAccount();
-                    //鍒锋柊涓�娆′綇瀹呯綉鍏�
-                    new HttpServerRequest().GetHomeGatewayList();
-
-                    Application.RunOnMainThread(() =>
-                    {
-                        btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.Name;
-                        //閲嶇疆缃戝叧鐘舵��
-                        DriverLayer.Control.Ins.GatewayOnline = false;
-                    });
-
-                    //鎼滅储缃戝叧
-                    DriverLayer.Control.Ins.SearchLoaclGateway();
-                }
-                catch (Exception ex)
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.OperationFailed),
-                                   Language.StringByID(StringId.Close)).Show();
-                    });
-                    MainPage.Log(ex.Message);
-                }
-                finally
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        waitPage.Hide();
-                        waitPage.RemoveFromParent();
-                        MainPage.InitializationData();
-                    });
-                }
-            })
-            { IsBackground = true }.Start();
+            btnCurResidenceName.Text = DB_ResidenceData.Instance.CurrentRegion.Name;
+            DB_ResidenceData.Instance.EixtAccount();
+            //鍒锋柊浣忓畢鏁版嵁
+            Common.ApiUtlis.Ins.DownloadData();
         }
         #endregion
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
index 6a538db..296a02e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
@@ -66,7 +66,7 @@
             btnCollection.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                aC.SaveFunctionData(true);
+                aC.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
old mode 100755
new mode 100644
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
index 9a0acd5..809de71 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
@@ -63,7 +63,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                curtain.SaveFunctionData(true);
+                curtain.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
index a8cd892..d5c41fe 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
@@ -135,7 +135,7 @@
             btnCollection.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                curtain.SaveFunctionData(true);
+                curtain.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
index 4928915..4bb6b5d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
@@ -135,7 +135,7 @@
             btnCollection.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                curtain.SaveFunctionData(true);
+                curtain.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
old mode 100755
new mode 100644
index 7785217..11f6b3b
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
@@ -51,7 +51,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                fan.SaveFunctionData(true);
+                fan.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
old mode 100755
new mode 100644
index 058be7c..b88cf2b
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -49,7 +49,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = socketFunction.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                socketFunction.SaveFunctionData(true);
+                socketFunction.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
old mode 100755
new mode 100644
index cdbf1b7..718ffed
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -29,7 +29,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = tv.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                tv.SaveFunctionData(true);
+                tv.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
index 95ab2fa..6f47b62 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
@@ -68,7 +68,7 @@
             btnCollection.MouseUpEventHandler += (sender, e) =>
             {
                 btnCollection.IsSelected = fh.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                fh.SaveFunctionData(true);
+                fh.CollectFunction();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index 8ce8ad9..881ab91 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -37,7 +37,7 @@
         /// <summary>
         /// 娓愬彉鏃堕棿淇敼
         /// </summary>
-        DiyImageSeekBar barFadeTime;
+        //DiyImageSeekBar barFadeTime;
         /// <summary>
         /// 鑹叉俯鐨勬粦鍔ㄦ帶浠�
         /// </summary>
@@ -141,9 +141,9 @@
             dimmerBar = new WaveSeekBarOn()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(74 + 16),
-                Width = Application.GetRealWidth(142 - 40),
-                Height = Application.GetRealHeight(222 - 16 - 16),
+                Y = Application.GetRealHeight(108),
+                Width = Application.GetRealWidth(142 - 16 -16),
+                Height = Application.GetRealHeight(222),
                 BorderColor = 0x00000000,
                 CornerRadius = Application.GetRealWidth(20),
                 BorderWidth = 0,
@@ -177,7 +177,7 @@
             //鑹叉俯
             var btnTempClolor = new Button();
             btnTempClolor.X = Application.GetRealWidth(35);
-            btnTempClolor.Y = Application.GetRealHeight(306);
+            btnTempClolor.Y = Application.GetRealHeight(306 +60);
             btnTempClolor.Width = Application.GetRealWidth(224);
             btnTempClolor.Height = Application.GetRealHeight(21);
             btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
@@ -239,63 +239,63 @@
             #endregion
 
             #region 娓愬彉鏃堕棿璋冭妭
-            var btnGradualChangeText = new Button()
-            {
-                X = Application.GetRealWidth(35),
-                Y = Application.GetRealHeight(385),
-                Width = Application.GetRealWidth(224),
-                Height = Application.GetRealHeight(21),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.FirstLevelTitleColor,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                TextID = StringId.SpeedOfChange,
-            };
-            controlView.AddChidren(btnGradualChangeText);
+            //var btnGradualChangeText = new Button()
+            //{
+            //    X = Application.GetRealWidth(35),
+            //    Y = Application.GetRealHeight(385),
+            //    Width = Application.GetRealWidth(224),
+            //    Height = Application.GetRealHeight(21),
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.FirstLevelTitleColor,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //    TextID = StringId.SpeedOfChange,
+            //};
+            //controlView.AddChidren(btnGradualChangeText);
 
-            var btnGradualChangeMinValuesText = new Button()
-            {
-                X = Application.GetRealWidth(35),
-                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(22),
-                Height = Application.GetRealHeight(21),
-                Text = "0s",
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            controlView.AddChidren(btnGradualChangeMinValuesText);
+            //var btnGradualChangeMinValuesText = new Button()
+            //{
+            //    X = Application.GetRealWidth(35),
+            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(22),
+            //    Height = Application.GetRealHeight(21),
+            //    Text = "0s",
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.PromptingColor1,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //};
+            //controlView.AddChidren(btnGradualChangeMinValuesText);
 
-            barFadeTime = new DiyImageSeekBar()
-            {
-                X = btnGradualChangeMinValuesText.Right,
-                Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(210),
-                Height = Application.GetRealHeight(54),
-                SeekBarViewHeight = Application.GetRealHeight(8),
-                ThumbImagePath = "Public/ThumbImage.png",
-                ThumbImageHeight = Application.GetRealHeight(54),
-                ProgressBarColor = CSS_Color.MainColor,
-                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
-                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                ProgressBarUnitSring = "s",
-                MaxValue = 10,
-                Progress = light.fadeTime,
-                SeekBarPadding = Application.GetRealWidth(20),
-            };
-            controlView.AddChidren(barFadeTime);
+            //barFadeTime = new DiyImageSeekBar()
+            //{
+            //    X = btnGradualChangeMinValuesText.Right,
+            //    Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(210),
+            //    Height = Application.GetRealHeight(54),
+            //    SeekBarViewHeight = Application.GetRealHeight(8),
+            //    ThumbImagePath = "Public/ThumbImage.png",
+            //    ThumbImageHeight = Application.GetRealHeight(54),
+            //    ProgressBarColor = CSS_Color.MainColor,
+            //    ProgressTextColor = CSS_Color.FirstLevelTitleColor,
+            //    ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //    ProgressBarUnitSring = "s",
+            //    MaxValue = 10,
+            //    Progress = light.fadeTime,
+            //    SeekBarPadding = Application.GetRealWidth(20),
+            //};
+            //controlView.AddChidren(barFadeTime);
 
-            var btnGradualChangeMaxValuesText = new Button()
-            {
-                X = barFadeTime.Right,
-                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
-                Width = Application.GetRealWidth(35),
-                Height = Application.GetRealHeight(21),
-                Text = "10s",
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            controlView.AddChidren(btnGradualChangeMaxValuesText);
+            //var btnGradualChangeMaxValuesText = new Button()
+            //{
+            //    X = barFadeTime.Right,
+            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
+            //    Width = Application.GetRealWidth(35),
+            //    Height = Application.GetRealHeight(21),
+            //    Text = "10s",
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextColor = CSS_Color.PromptingColor1,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //};
+            //controlView.AddChidren(btnGradualChangeMaxValuesText);
             #endregion
 
             btnSwitch = new Button()
@@ -314,9 +314,9 @@
             btnShortcut = new Button();
             btnShortcut.X = Application.GetRealWidth(104);
             btnShortcut.Y = btnSwitch.Y;
-            btnShortcut.Width = Application.GetRealWidth(40);
-            btnShortcut.Height = Application.GetRealWidth(40);
-            btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatrueQuick.png";
+            btnShortcut.Width = Application.GetRealWidth(36);
+            btnShortcut.Height = Application.GetRealWidth(36);
+            btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             controlView.AddChidren(btnShortcut);
             btnShortcut.MouseUpEventHandler += (sender, e) =>
             {
@@ -396,6 +396,7 @@
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                 DriverLayer.Control.Ins.SendWriteCommand(light, d);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             };
             //娓╅Θ 2700k
             var btnCozy = new Button();
@@ -420,6 +421,7 @@
                 DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27;
                 barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
                 frameBack.Close();
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
             };
 
             //浼氬鍥炬爣
@@ -440,6 +442,7 @@
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                 DriverLayer.Control.Ins.SendWriteCommand(light, d);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
             };
 
             //浼氬 3000k
@@ -463,6 +466,7 @@
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                 DriverLayer.Control.Ins.SendWriteCommand(light, d);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
             };
 
             //闃呰鍥炬爣
@@ -483,6 +487,7 @@
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                 DriverLayer.Control.Ins.SendWriteCommand(light, d);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
             };
             //闃呰 6500k
             var btnRead = new Button();
@@ -505,6 +510,7 @@
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                 DriverLayer.Control.Ins.SendWriteCommand(light, d);
+                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
             };
             btnCozy.IsSelected = false;
             btnCozyIcon.IsSelected = false;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index e3103d7..73c1efc 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -64,11 +64,11 @@
         /// </summary>
         void LoadEvet_ChangeFadeTime()
         {
-            barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
-            {
-                light.fadeTime = e;
-                light.SaveFunctionData(true);
-            };
+            //barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
+            //{
+            //    light.fadeTime = e;
+            //    light.SaveFunctionData(true);
+            //};
         }
 
         /// <summary>
@@ -85,13 +85,22 @@
                         //璁剧疆鑷畾涔夌殑鏂囨湰
                         barColorTemplatrue.SetCustomText(value * 100 + "K");
                         light.Attr_CCT.curValue = value * 100;
-                        System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                        d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
-                        Control.Ins.SendWriteCommand(light, d);
+                        //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                        //d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                        //Control.Ins.SendWriteCommand(light, d);
                     });
-                    System.Threading.Thread.Sleep(200);
+                    //System.Threading.Thread.Sleep(200);
                 }).Start();
+            };
+
+            barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) =>
+            {
+                light.Attr_CCT.curValue = value * 100;
+                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
+                Control.Ins.SendWriteCommand(light, d);
             };
+
         }
 
         /// <summary>
@@ -101,7 +110,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                light.SaveFunctionData(true);
+                light.CollectFunction();
             };
         }
 
@@ -116,46 +125,48 @@
             dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
                 onDimmerBar = false;
                 light.brightness = dimmerBar.Progress;
-                //Control.Send(CommandType_A.write, light);
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
                 Control.Ins.SendWriteCommand(light, d);
-                light.fadeTime = barFadeTime.Progress;
+                //light.fadeTime = barFadeTime.Progress;
             };
-            dimmerBar.OnProgressChangedEvent = (sender, e) => {
-                light.fadeTime = 0;
-                if (!btnSwitch.IsSelected)
-                {
-                    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
-                }
-                btnSwitch.IsSelected = e > 0 ? true : false;
-                light.brightness = e;
-                light.trait_on_off.curValue = e > 0 ? "on" : "off";
+            dimmerBar.OnProgressChangedEvent = (sender, e) =>
+            {
+                //light.fadeTime = 0;
+                //if (!btnSwitch.IsSelected)
+                //{
+                //    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+                //}
+                //btnSwitch.IsSelected = e > 0 ? true : false;
+                //light.brightness = e;
+                //light.trait_on_off.curValue = e > 0 ? "on" : "off";
 
-                if (e == 0 || e == 100)
-                {
-                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                    Control.Ins.SendWriteCommand(light, d);
-                }
-                else
-                {
-                    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
-                    {
-                        light.refreshTime = DateTime.Now;
-                        new System.Threading.Thread(() =>
-                        {
-                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                            Control.Ins.SendWriteCommand(light, d);
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                }
+                //if (e == 0 || e == 100)
+                //{
+                //    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //    Control.Ins.SendWriteCommand(light, d);
+                //}
+                //else
+                //{
+                //    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+                //    {
+                //        light.refreshTime = DateTime.Now;
+                //        new System.Threading.Thread(() =>
+                //        {
+                //            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //            Control.Ins.SendWriteCommand(light, d);
+                //        })
+                //        { IsBackground = true }.Start();
+                //    }
+                //}
 
                 btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
                 btnBrightnessText.Text = light.brightness + "%";
             };
+
+
         }
 
         /// <summary>
@@ -165,7 +176,7 @@
         {
             btnSwitch.MouseUpEventHandler += (sender, e) =>
             {
-                light.fadeTime = barFadeTime.Progress;
+                //light.fadeTime = barFadeTime.Progress;
                 btnSwitch.IsSelected = !btnSwitch.IsSelected;
                 if (btnSwitch.IsSelected)
                 {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
index a97feb3..5dfd41c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
@@ -77,7 +77,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                light.SaveFunctionData(true);
+                light.CollectFunction();
             };
         }
 
@@ -98,38 +98,38 @@
                 Control.Ins.SendWriteCommand(light, d);
                 light.fadeTime = barFadeTime.Progress;
             };
-            dimmerBar.OnProgressChangedEvent = (sender, e) => {
-                light.fadeTime = 0;
-                if (!btnSwitch.IsSelected)
-                {
-                    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
-                }   
-                btnSwitch.IsSelected = e > 0 ? true : false;
-                light.brightness = e;
-                light.trait_on_off.curValue = e > 0 ? "on" : "off";
-
-                if (e == 0 || e == 100)
-                {
-                    //Control.Send(CommandType_A.write, this.light);
-                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                    Control.Ins.SendWriteCommand(light, d);
-                }
-                else
-                {
-                    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
-                    {
-                        light.refreshTime = DateTime.Now;
-                        new System.Threading.Thread(() =>
-                        {
-                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                            Control.Ins.SendWriteCommand(light, d);
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                }
-
+            //20201223 鍒犻櫎婊戝姩鍙戦�佸懡浠わ紝闃叉鎺т欢璺冲姩
+            dimmerBar.OnProgressChangedEvent = (sender, e) =>
+            {
+                //light.fadeTime = 0;
+                //if (!btnSwitch.IsSelected)
+                //{
+                //    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+                //}
+                //btnSwitch.IsSelected = e > 0 ? true : false;
+                //light.brightness = e;
+                //light.trait_on_off.curValue = e > 0 ? "on" : "off";
+                //if (e == 0 || e == 100)
+                //{
+                //    //Control.Send(CommandType_A.write, this.light);
+                //    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //    Control.Ins.SendWriteCommand(light, d);
+                //}
+                //else
+                //{
+                //    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+                //    {
+                //        light.refreshTime = DateTime.Now;
+                //        new System.Threading.Thread(() =>
+                //        {
+                //            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //            Control.Ins.SendWriteCommand(light, d);
+                //        })
+                //        { IsBackground = true }.Start();
+                //    }
+                //}
                 btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40);
                 btnBrightnessText.Text = light.brightness + "%";
             };
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
index 48d7b7e..0d7de11 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
@@ -128,7 +128,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                light.SaveFunctionData(true);
+                light.CollectFunction();
             };
         }
 
@@ -153,40 +153,40 @@
                 light.fadeTime = barFadeTime.Progress;
             };
             dimmerBar.OnProgressChangedEvent = (sender, e) => {
-                light.fadeTime = 0;
-                if (!btnSwitch.IsSelected)
-                {
-                    dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
-                }
-                btnSwitch.IsSelected = e > 0 ? true : false;
-                light.brightness = e;
-                light.trait_on_off.curValue = e > 0 ? "on" : "off";
+                //light.fadeTime = 0;
+                //if (!btnSwitch.IsSelected)
+                //{
+                //    dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
+                //}
+                //btnSwitch.IsSelected = e > 0 ? true : false;
+                //light.brightness = e;
+                //light.trait_on_off.curValue = e > 0 ? "on" : "off";
 
-                if (e == 0 || e == 100)
-                {
-                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                    Control.Ins.SendWriteCommand(light, d);
-                }
-                else
-                {
-                    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
-                    {
-                        light.refreshTime = DateTime.Now;
-                        new System.Threading.Thread(() =>
-                        {
-                            //Control.Send(CommandType_A.write, light);
-                            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
-                            Control.Ins.SendWriteCommand(light, d);
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                    else
-                    {
-                        MainPage.Log("skip dimmer control!!");
-                    }
-                }
+                //if (e == 0 || e == 100)
+                //{
+                //    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //    d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //    Control.Ins.SendWriteCommand(light, d);
+                //}
+                //else
+                //{
+                //    if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+                //    {
+                //        light.refreshTime = DateTime.Now;
+                //        new System.Threading.Thread(() =>
+                //        {
+                //            //Control.Send(CommandType_A.write, light);
+                //            System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                //            d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
+                //            Control.Ins.SendWriteCommand(light, d);
+                //        })
+                //        { IsBackground = true }.Start();
+                //    }
+                //    else
+                //    {
+                //        MainPage.Log("skip dimmer control!!");
+                //    }
+                //}
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
old mode 100755
new mode 100644
index ac77056..82b44f0
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
@@ -48,7 +48,7 @@
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
                 btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                light.SaveFunctionData(true);
+                light.CollectFunction();
             };
         }
 

--
Gitblit v1.8.0