From 271faaf6664166dc368639b9f2e577f63f901be5 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 22:23:57 +0800
Subject: [PATCH] 20201223-99

---
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs                                           |    2 
 HDL_ON/Common/ApiUtlis.cs                                                      |   30 +
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs       |    2 
 HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs                       |    2 
 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs                        |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs       |   37 ++
 HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs                                  |    2 
 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs                 |    2 
 HDL_ON/Entity/Room.cs                                                          |  156 +++----------
 HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs                               |   25 +
 .vs/HDL_APP_Project/xs/UserPrefs.xml                                           |   37 ++-
 HDL_ON/DAL/DriverLayer/Control.cs                                              |    7 
 HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs                                  |    4 
 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs                           |    7 
 HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs               |    4 
 HDL_ON/Entity/DB_ResidenceData.cs                                              |    2 
 HDL_ON/DAL/DriverLayer/Control_Udp.cs                                          |    4 
 HDL_ON/Entity/FunctionList.cs                                                  |   30 +-
 HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs                   |    2 
 HDL_ON/Entity/Function/Function.cs                                             |  115 ++++++++--
 HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs                          |   21 +
 HDL_ON/DAL/Server/HttpServerRequest.cs                                         |   18 +
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs |   58 ++++-
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs          |   31 ++
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs               |    8 
 25 files changed, 365 insertions(+), 243 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 4a4c089..68edc00 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,14 +1,10 @@
 锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Function.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs">
     <Files>
-      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="188" Column="14" />
-      <File FileName="HDL_ON/Entity/FunctionList.cs" Line="584" Column="40" />
-      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="322" Column="21" />
-      <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="312" Column="32" />
-      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="692" Column="10" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs" Line="81" Column="38" />
-      <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="177" Column="75" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="346" Column="30" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="862" Column="25" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" Line="28" Column="84" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -21,16 +17,30 @@
                 <Node name="Server" expanded="True" />
               </Node>
               <Node name="Entity" expanded="True">
-                <Node name="Function" expanded="True">
-                  <Node name="Function.cs" selected="True" />
-                </Node>
+                <Node name="Function" expanded="True" />
               </Node>
               <Node name="UI" expanded="True">
+                <Node name="UI0-Public" expanded="True" />
                 <Node name="UI2" expanded="True">
+                  <Node name="1-HomePage" expanded="True" />
+                  <Node name="2-Classification" expanded="True" />
                   <Node name="3-Intelligence" expanded="True">
+                    <Node name="Automation" expanded="True" />
                     <Node name="Scene" expanded="True" />
                   </Node>
-                  <Node name="FuntionControlView" expanded="True" />
+                  <Node name="4-PersonalCenter" expanded="True">
+                    <Node name="RoomListManage" expanded="True">
+                      <Node name="AddRoom" expanded="True" />
+                    </Node>
+                  </Node>
+                  <Node name="FuntionControlView" expanded="True">
+                    <Node name="AC" expanded="True" />
+                    <Node name="Electrical" expanded="True" />
+                    <Node name="FoolHeating" expanded="True" />
+                    <Node name="Light" expanded="True">
+                      <Node name="RGBPageBLL.cs" selected="True" />
+                    </Node>
+                  </Node>
                 </Node>
               </Node>
             </Node>
@@ -47,12 +57,11 @@
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI0-Public/PublicAssmebly.cs" relfile="HDL_ON/UI/UI0-Public/PublicAssmebly.cs" line="730" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" line="315" column="1" />
-      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="288" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" line="144" column="1" />
     </BreakpointStore>
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 24eac42..52a8ac9 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -19,7 +19,7 @@
         {
             get
             {
-                if(apiUtlis == null)
+                if (apiUtlis == null)
                 {
                     apiUtlis = new ApiUtlis();
                 }
@@ -33,7 +33,7 @@
         {
             get
             {
-                if(httpRequest == null)
+                if (httpRequest == null)
                 {
                     httpRequest = new HttpServerRequest();
                 }
@@ -47,7 +47,7 @@
         {
             bool result = DB_ResidenceData.Instance.HomeGateway.gatewayStatus;
 
-            if(!result)
+            if (!result)
             {
 
             }
@@ -131,9 +131,12 @@
                     {
                         MainPage.Log($"璇诲彇鎴块棿淇℃伅鎴愬姛");
                         var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(roomResult.Data.ToString());
-                        if (revData != null)
+                        if (revData == null)
                         {
-                            SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list, OptionType.Cover);
+                            revData = new SpatialApiPack();
+                        }
+                        {
+                            SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list);
                         }
                     }
                     else
@@ -146,7 +149,10 @@
                     {
                         MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
                         var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
-                        if (deviceList != null)
+                        if (deviceList == null)
+                        {
+                            deviceList = new DevcieApiPack();
+                        }
                         {
                             if (FunctionList.List.GetDeviceFunctionList().Count > 0)
                             {
@@ -169,12 +175,13 @@
                                         i++;
                                         if (localFunction.modifyTime != newFunction.modifyTime)
                                         {
+                                            //鍙紭鍖�
                                             localFunction.name = newFunction.name;
                                             localFunction.collect = newFunction.collect;
                                             localFunction.modifyTime = newFunction.modifyTime;
                                             localFunction.roomIds = newFunction.roomIds;
                                             localFunction.bus = newFunction.bus;
-                                            localFunction.SaveFunctionData(false);
+                                            localFunction.SaveFunctionFile();
                                         }
                                         deviceList.list.Remove(newFunction);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
                                     }
@@ -183,7 +190,7 @@
                             //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
                             foreach (var newFunction in deviceList.list)
                             {
-                                newFunction.SaveFunctionData(false);
+                                newFunction.SaveFunctionFile();
                                 FunctionList.List.IniFunctionList(newFunction.savePath);
                             }
                         }
@@ -199,7 +206,10 @@
                     {
                         MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛");
                         var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
-                        if (sceneList != null)
+                        if (sceneList == null)
+                        {
+                            sceneList = new List<Scene>();
+                        }
                         {
                             for (int i = 0; i < FunctionList.List.scenes.Count;)
                             {
@@ -305,4 +315,4 @@
             { IsBackground = true }.Start();
         }
     }
-}
+}
\ No newline at end of file
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 8546d1d..a894698 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -291,6 +291,8 @@
                 }
             }
 
+            MainPage.Log($"鍙戦�佹暟鎹�:{Newtonsoft.Json.JsonConvert.SerializeObject(commandDictionary)}");
+
             //杩滅▼閫氳
             if (Ins.IsRemote)
             {
@@ -300,7 +302,6 @@
                 var actionObjs = new List<ApiAlinkControlActionObj>();
                 actionObjs.Add(apiControlData);
                 var pack = httpServer.ControlDevice(actionObjs);
-                //MainPage.Log($"{pack.Code}:{pack.Data}");
             }
             //鏈湴閫氳
             else
@@ -405,8 +406,8 @@
         {
             if (Ins.IsRemote)
             {
-                var pm = new HDL_ON.DAL.Server.HttpServerRequest();
-                pm.ExecuteScene(scene.userSceneId);
+                var pm = new DAL.Server.HttpServerRequest();
+                var result = pm.ExecuteScene(scene.userSceneId);
             }
             else
             {
diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
index 5967ef9..e5bda32 100644
--- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -249,7 +249,7 @@
                             }
                         }
                         ControlBytesSend(Command.SetSingleLight, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID,
-                            new byte[] { f.localFunction.bus.LoopId, brightness });
+                            new byte[] { f.localFunction.bus.LoopId, brightness, (byte)(f.localFunction.delay / 255), (byte)(f.localFunction.delay % 255) });
                         break;
                     case FunctionType.RGB:
                         break;
@@ -861,7 +861,7 @@
             {
                 wait(); 
             }
-            //MainPage.Log($"鍙戦�丠dl-Link鏁版嵁锛孖P:{Control.Ins.reportIp}:8585");
+            MainPage.Log($"鍙戦�丠dl-Link鏁版嵁锛孖P:{Control.Ins.reportIp}:8585");
         }
     }
 
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 19c8c8a..c644bdc 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1824,7 +1824,7 @@
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
-            d.Add("deviceId", function.deviceId);//DriverLayer.Control.Ins.GatewayId);
+            d.Add("deviceId", function.deviceId);
             d.Add("name", function.name);
             d.Add("collect", function.collect);
             d.Add("roomIds", function.roomIds);
@@ -1833,6 +1833,22 @@
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
         }
         /// <summary>
+        /// 鏇存柊璁惧缁戝畾鎴块棿淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdataDevcieBindRoomInfo(Function function)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+            d.Add("deviceId", function.deviceId);
+            d.Add("roomIds", function.roomIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+        }
+
+
+        /// <summary>
         /// 璁惧缁戝畾鎴块棿
         /// </summary>
         public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds)
diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index 81306ec..8017fc0 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -107,7 +107,7 @@
                     }
                     instance.residenceImage = "Classification/Room/Roombg.png";
                     //鍒濆鍖栦綇瀹呭姛鑳芥暟鎹�
-                    SpatialInfo.CurrentSpatial.InitRoomFunction();
+                    SpatialInfo.CurrentSpatial.InitRoomListFunctions();
 
                 }
                 return instance;
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 68d53ae..26c6ff3 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -322,37 +322,98 @@
         /// </summary>
         public void SaveFunctionFile()
         {
-
+            var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+            FileUtlis.Files.WriteFileByBytes(savePath, ssd);
         }
-
+        /// <summary>
+        /// 淇濆瓨鎴块棿缁戝畾淇℃伅
+        /// </summary>
+        public void UpdataRoomIds()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this);
+                //鐩存帴淇濆瓨鏈湴锛�
+                SaveFunctionFile();
+                if (pack.Code == StateCode.SUCCESS)
+                {
+                }
+                else
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+        /// <summary>
+        /// 鏇存柊鍔熻兘淇℃伅
+        /// </summary>
+        public void UpdataFuncitonInfo()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var pm = new HttpServerRequest();
+                var pack = pm.UpdataDevcieInfo(this);
+                SaveFunctionFile();
+                if (pack.Code == StateCode.SUCCESS)
+                {
+                }
+                else
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+        /// <summary>
+        /// 鏇存柊鍔熻兘鍚嶇О
+        /// </summary>
+        public void UpdataFunctionName()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var pm = new HttpServerRequest();
+                var pack = pm.UpdataDevcieInfo(this);
+                SaveFunctionFile();
+                if (pack.Code == StateCode.SUCCESS)
+                {
+                }
+                else
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                }
+            })
+            { IsBackground = true }.Start();
+        }
         /// <summary>
         /// 淇濆瓨鍔熻兘鏁版嵁
         /// </summary>
-        public void SaveFunctionData(bool upSevser)
-        {
-            if (upSevser)
-            {
-                new System.Threading.Thread(() =>
-                {
-                    var pm = new HttpServerRequest();
-                    var pack = pm.UpdataDevcieInfo(this);
-                    if (pack.Code == StateCode.SUCCESS)
-                    {
-                        var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
-                        FileUtlis.Files.WriteFileByBytes(savePath, ssd);
-                    }
-                    else
-                    {
-                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
-                    }
-                });
-            }
-            else
-            {
-                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
-                FileUtlis.Files.WriteFileByBytes(savePath, ssd);
-            }
-        }
+        //public void SaveFunctionData(bool upSevser)
+        //{
+        //    if (upSevser)
+        //    {
+        //        new System.Threading.Thread(() =>
+        //        {
+        //            var pm = new HttpServerRequest();
+        //            var pack = pm.UpdataDevcieInfo(this);
+        //            if (pack.Code == StateCode.SUCCESS)
+        //            {
+        //                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+        //                FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+        //            }
+        //            else
+        //            {
+        //                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+        //            }
+        //        })
+        //        { IsBackground = true }.Start();
+        //    }
+        //    else
+        //    {
+        //        var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+        //        FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+        //    }
+        //}
 
 
         /// <summary>
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 7adfaaf..4429070 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -254,41 +254,41 @@
                 case FunctionType.AC:
                     var sidObj =  Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.aCs.Add(sidObj);
-                    sidObj.SaveFunctionData(false);
+                    sidObj.SaveFunctionFile();
                     break;
                 case FunctionType.FloorHeating:
                     var sidObj1 =  Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.floorHeatings.Add(sidObj1);
-                    sidObj1.SaveFunctionData(false);
+                    sidObj1.SaveFunctionFile();
                     break;
                 case FunctionType.Dimmer:
                 case FunctionType.RGB:
                 case FunctionType.Relay:
                     var sidObj2 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.lights.Add(sidObj2);
-                    sidObj2.SaveFunctionData(false);
+                    sidObj2.SaveFunctionFile();
                     break;
                 case FunctionType.Curtain:
                 case FunctionType.RollingShutter:
                 case FunctionType.MotorCurtain:
                     var sidObj3 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.curtains.Add(sidObj3 );
-                    sidObj3.SaveFunctionData(false);
+                    sidObj3.SaveFunctionFile();
                     break;
                 case FunctionType.TV:
                     var sidObj4 =  Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.tVs.Add(sidObj4);
-                    sidObj4.SaveFunctionData(false);
+                    sidObj4.SaveFunctionFile();
                     break;
                 case FunctionType.Socket:
                     var sidObj5 =  Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.switchSockets.Add(sidObj5);
-                    sidObj5.SaveFunctionData(false);
+                    sidObj5.SaveFunctionFile();
                     break;
                 case FunctionType.Fan:
                     var sidObj6 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.fans.Add(sidObj6);
-                    sidObj6.SaveFunctionData(false);
+                    sidObj6.SaveFunctionFile();
                     break;
                 case FunctionType.CO2:
                 case FunctionType.TVOC:
@@ -297,7 +297,7 @@
                 case FunctionType.Humidity:
                     var sidObj7 =  Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0));
                     List.sensorsEnvironmentalScience.Add(sidObj7);
-                    sidObj7.SaveFunctionData(false);
+                    sidObj7.SaveFunctionFile();
                     break;
             }
         }
@@ -417,7 +417,7 @@
                                         localFunction.modifyTime = newFunction.modifyTime;
                                         localFunction.roomIds = newFunction.roomIds;
                                         localFunction.bus = newFunction.bus;
-                                        localFunction.SaveFunctionData(false);
+                                        localFunction.SaveFunctionFile();
                                     }
                                     deviceList.list.Remove(newFunction);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
                                 }
@@ -426,7 +426,7 @@
                         //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
                         foreach (var newFunction in deviceList.list)
                         {
-                            newFunction.SaveFunctionData(false);
+                            newFunction.SaveFunctionFile();
                             List.IniFunctionList(newFunction.savePath);
                         }
                     }
@@ -499,8 +499,10 @@
         }
 
 
+
         /// <summary>
         /// 鍒犻櫎鍦烘櫙
+        /// todo
         /// </summary>
         public void DeleteScene(Scene scene,bool upSevser)
         {
@@ -510,22 +512,22 @@
                 var packCode = pm.DeleteScene(scene.userSceneId);
                 if (packCode == StateCode.SUCCESS)
                 {
-                    Common.FileUtlis.Files.DeleteFile(scene.savePath);
+                    FileUtlis.Files.DeleteFile(scene.savePath);
                     List.scenes.Remove(scene);
                 }
                 else
                 {
-                    Utlis.ShowTip(Shared.Language.StringByID(StringId.DeleteSceneFail) + "Code:" + packCode);
+                    IMessageCommon.Current.ShowErrorInfoAlter(packCode);
                 }
             }
             else
             {
-                Common.FileUtlis.Files.DeleteFile(scene.savePath);
+                FileUtlis.Files.DeleteFile(scene.savePath);
                 List.scenes.Remove(scene);
             }
         }
         /// <summary>
-        /// 鍒犻櫎鏈湴鍔熻兘鏂囦欢
+        /// 鍒犻櫎鏈湴鍔熻兘鍙婃枃浠�
         /// </summary>
         public void DeleteFunction(Function delTemp)
         {
diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs
index 0f3cc1d..055a4c6 100644
--- a/HDL_ON/Entity/Room.cs
+++ b/HDL_ON/Entity/Room.cs
@@ -65,121 +65,33 @@
         ///// </summary>
         //public bool DeleteSign = false;
 
-
-        protected ResponsePackNew SaveSpatialInfo()
-        {
-            var pm = new HttpServerRequest();
-            var revPack = new ResponsePackNew();
-            if (string.IsNullOrEmpty(createTime) && string.IsNullOrEmpty(modifyTime))
-            {
-                revPack = pm.AddRoom(new List<SpatialInfo>() { this });
-            }
-            else if (string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime))
-            {
-                revPack = pm.DeleteRoom(new List<string>() { roomId });
-            }
-            else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime))
-            {
-                revPack = pm.UpdateRoom(new List<SpatialInfo>() { this });
-            }
-            return revPack;
-        }
-
-        /// <summary>
-        /// 涓嬭浇浜戠鎴块棿鏁版嵁
-        /// </summary>
-        public void DownloadRoomList()
-        {
-            new System.Threading.Thread(() =>
-            {
-                var pm = new HttpServerRequest();
-                var pack = pm.GetRoomList();
-                if (pack.Code == StateCode.SUCCESS)
-                {
-                    var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(pack.Data.ToString());
-                    if (revData != null)
-                    {
-                        CurrentSpatial.UpdateSpatialList(revData.list, OptionType.Cover);
-                    }
-                }
-                else
-                {
-                    MainPage.Log($"璇诲彇鎴块棿鏁版嵁澶辫触:\r\nCode:{pack.Code}; msg:{pack.message}");
-                }
-            })
-            { IsBackground = true }.Start();
-        }
-
         /// <summary>
         /// 鏇存柊绌洪棿淇℃伅
         /// </summary>
         /// <param name="spatials">绌洪棿淇℃伅</param>
         /// <param name="optionType">鎿嶄綔绫诲瀷锛欰DD/UPDATE/DELETE</param>
-        public void UpdateSpatialList(List<SpatialInfo> spatials,OptionType optionType)
+        public void UpdateSpatialList(List<SpatialInfo> spatials)
         {
             var roomUpdateList = spatials.FindAll((obj) => obj.roomType == "ROOM");
             var floorUpdateList = spatials.FindAll((obj) => obj.roomType == "FLOOR");
             //澶勭悊鎴块棿鍒楄〃
             if (roomUpdateList != null && roomUpdateList.Count > 0)
             {
-                if (optionType == OptionType.Update)
+                CurrentSpatial.DeleteAllRoom();
+                foreach (var newRoom in roomUpdateList)
                 {
-                    foreach (var updateTemp in roomUpdateList)
-                    {
-                        var localRoom = CurrentSpatial.RoomList.Find((obj) => obj.roomId == updateTemp.roomId);
-                        if (localRoom != null)
-                        {
-                            if (localRoom.modifyTime != updateTemp.modifyTime)
-                            {
-                                localRoom.roomName = updateTemp.roomName;
-                                localRoom.roomImage = updateTemp.roomImage;
-                                localRoom.parentId = updateTemp.parentId;
-                                localRoom.createTime = updateTemp.createTime;
-                                localRoom.modifyTime = updateTemp.modifyTime;
-                                localRoom.SaveRoomData(false);
-                            }
-                        }else
-                        {
-                            updateTemp.SaveRoomData(false);
-                        }
-                    }
-                }
-                else if (optionType == OptionType.Cover)
-                {
-                    CurrentSpatial.DeleteAllRoom();
-                    foreach(var newRoom in roomUpdateList)
-                    {
-                        newRoom.SaveRoomData(false);
-                        RoomList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(
-                            Newtonsoft.Json.JsonConvert.SerializeObject(newRoom)));
-                    }
+                    newRoom.SaveRoomFile();
+                    RoomList.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(
+                        Newtonsoft.Json.JsonConvert.SerializeObject(newRoom)));
                 }
             }
             //妤煎眰鎴块棿鍒楄〃
             if (floorUpdateList != null && floorUpdateList.Count > 0)
             {
-                if (optionType == OptionType.Update)
+                FloorList.Clear();
+                foreach (var updateTemp in floorUpdateList)
                 {
-                    foreach(var updateTemp in floorUpdateList)
-                    {
-                        var localFloor = FloorList.Find((obj) => obj.roomId == updateTemp.roomId);
-                        if (localFloor == null)
-                        {
-                            FloorList.Add(updateTemp);
-                        }
-                        else
-                        {
-                            localFloor = updateTemp;
-                        }
-                    }
-                }
-                if(optionType == OptionType.Cover)
-                {
-                    FloorList.Clear();
-                    foreach (var updateTemp in floorUpdateList)
-                    {
-                        FloorList.Add(updateTemp);
-                    }
+                    FloorList.Add(updateTemp);
                 }
                 var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList));
                 Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
@@ -439,7 +351,7 @@
         /// <summary>
         /// 鍒濆鍖栨瘡涓埧闂寸殑鍔熻兘鏁版嵁
         /// </summary>
-        public void InitRoomFunction()
+        public void InitRoomListFunctions()
         {
             new System.Threading.Thread(() =>
             {
@@ -448,8 +360,7 @@
                     //鍒濆鍖栦綇瀹呮墍鏈夋埧闂村姛鑳芥暟鎹�
                     foreach (var r in RoomList)
                     {
-                        r.GetRoomFunctions(true);
-                        r.GetRoomScenes(true);
+                        InitRoomFuntion(r);
                     }
                 }
                 catch (Exception ex)
@@ -459,25 +370,42 @@
             })
             { IsBackground = true }.Start();
         }
+        /// <summary>
+        /// 鍒濆鍖栨埧闂村姛鑳�
+        /// </summary>
+        /// <param name="tempRoom"></param>
+        public void InitRoomFuntion(Room tempRoom)
+        {
+            tempRoom.GetRoomFunctions(true);
+            tempRoom.GetRoomScenes(true);
+        }
 
         /// <summary>
-        /// 淇濆瓨鎴块棿鏁版嵁
+        /// 淇濆瓨鎴块棿鏁版嵁鏂囦欢
         /// </summary>
-        public string SaveRoomData(bool upServer = true)
+        public void SaveRoomFile()
         {
-            var packCode = StateCode.SUCCESS;
-            bool needSave = true;
-            if (upServer)
-            {
-                packCode = SaveSpatialInfo().Code;
-            }
-            if (needSave)
-            {
-                var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
-                Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
-            }
-            return packCode;
+            var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+            Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd);
         }
+        /// <summary>
+        /// 鏇存柊鎴块棿鏁版嵁
+        /// </summary>
+        public void UpdataRoomInfo()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var pm = new HttpServerRequest();
+                var pack = pm.UpdateRoom(new List<SpatialInfo>() { this });
+                this.SaveRoomFile();
+                if (pack.Code != StateCode.SUCCESS)
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+      
         #endregion
 
     }
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 608fa42..2e09e42 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -860,7 +860,7 @@
                     }
                     string msg = function.name + Language.StringByID(StringId.CollectionCancelled);
                     LoadDeviceFunctionControlZone();
-                    function.SaveFunctionData(true);
+                    function.CollectFunction();
                 };
 
                 var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone);
diff --git a/HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs
index 3e9cd4e..6ca0ac5 100644
--- a/HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs
@@ -30,7 +30,7 @@
         {
             Action editBackAction = () =>
             {
-                room.SaveRoomData();
+                room.UpdataRoomInfo();
                 ReLoadPage();
                 ReloadRoomName();
             };
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
index 2544446..25f51cf 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
@@ -92,22 +92,54 @@
 
         void RefreshFloorsListView(string floorName)
         {
-            try
+
+            var waitPage = new Loading();
+            MainPage.BaseView.AddChidren(waitPage);
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
+            new System.Threading.Thread(() =>
             {
-                var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
-                var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
-                if (addResult == DAL.Server.StateCode.SUCCESS)
+                try
                 {
-                    LoadFloorRow(f);
+                    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
+                    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f);
+                    if (addResult == DAL.Server.StateCode.SUCCESS)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            LoadFloorRow(f);
+                        });
+                    }
                 }
-            }
-            catch (Exception ex)
-            {
-                MainPage.Log("add floor eroor : " + ex.Message);
-            }
-            int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
-            floorsListView.Height = Application.GetRealHeight(50 * count);
-            contentView.Height = Application.GetRealHeight(50 * (count + 1));
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() => {
+                        waitPage.Hide();
+                        waitPage.RemoveFromParent();
+                        int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
+                        floorsListView.Height = Application.GetRealHeight(50 * count);
+                        contentView.Height = Application.GetRealHeight(50 * (count + 1));
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+
+            //try
+            //{
+            //    var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
+            //    var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
+            //    if (addResult == DAL.Server.StateCode.SUCCESS)
+            //    {
+            //        LoadFloorRow(f);
+            //    }
+            //}
+            //catch (Exception ex)
+            //{
+            //    MainPage.Log("add floor eroor : " + ex.Message);
+            //}
+            //int count = SpatialInfo.CurrentSpatial.FloorList.Count > 10 ? 10 : SpatialInfo.CurrentSpatial.FloorList.Count;
+            //floorsListView.Height = Application.GetRealHeight(50 * count);
+            //contentView.Height = Application.GetRealHeight(50 * (count + 1));
         }
 
         public void LoadPage()
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs
old mode 100755
new mode 100644
index f875ee5..7d77f96
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs
@@ -125,12 +125,33 @@
         {
             try
             {
-                var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
-                var addResult = SpatialInfo.CurrentSpatial.AddFloor(f,out f);
-                if (addResult == DAL.Server.StateCode.SUCCESS)
+                var waitPage = new Loading();
+                MainPage.BaseView.AddChidren(waitPage);
+                waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                new System.Threading.Thread(() =>
                 {
-                    LoadFloorRow(f);
-                }
+                    try
+                    {
+                        var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID };
+                        var addResult = SpatialInfo.CurrentSpatial.AddFloor(f, out f);
+                        if (addResult == DAL.Server.StateCode.SUCCESS)
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                LoadFloorRow(f);
+                            });
+                        }
+                    }
+                    catch { }
+                    finally
+                    {
+                        Application.RunOnMainThread(() => {
+                            waitPage.Hide();
+                            waitPage.RemoveFromParent();
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
             }
             catch (Exception ex)
             {
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
old mode 100755
new mode 100644
index 27f5b72..354dc82
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
@@ -33,12 +33,33 @@
                     }
                     else
                     {
-                        var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
-                        if (editResult == DAL.Server.StateCode.SUCCESS)
+                        var waitPage = new Loading();
+                        MainPage.BaseView.AddChidren(waitPage);
+                        waitPage.Start(Language.StringByID(StringId.PleaseWait));
+                        new System.Threading.Thread(() =>
                         {
-                            floor.roomName = newName;
-                            btn.Text = newName;
-                        }
+                            try
+                            {
+                                var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
+                                Application.RunOnMainThread(() =>
+                                {
+                                    if (editResult == DAL.Server.StateCode.SUCCESS)
+                                    {
+                                        floor.roomName = newName;
+                                        btn.Text = newName;
+                                    }
+                                });
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() => {
+                                    waitPage.Hide();
+                                    waitPage.RemoveFromParent();
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
                     }
                 };
                 var floors = new List<string>();
@@ -80,7 +101,11 @@
                                 row.RemoveFromParent();
                             }
                         }
-                        SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
+                        new System.Threading.Thread(() =>
+                        {
+                            SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
+                        })
+                        { IsBackground = true }.Start();
                     }
                 };
                 new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DelFloorTip, action);
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
index 3823a72..bdffce7 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
@@ -133,7 +133,7 @@
                         {
                             f.roomIds.Add(room.roomId);
                         }
-                        f.SaveFunctionData(true);
+                        f.UpdataRoomIds();
                     }
                     room.GetRoomFunctions(true);
                     bodyView.RemoveFromParent();
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
index dc3836b..8b8d43c 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
@@ -105,7 +105,7 @@
                 }
                 btnRoomName.Text = str;
                 room.roomName = str;
-                room.SaveRoomData();
+                room.UpdataRoomInfo();
             };
             EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
             {
@@ -131,7 +131,7 @@
                 Action floorsCallBackAction = () =>
                 {
                     btnFloorInfo.Text = room.floorName;
-                    room.SaveRoomData();
+                    room.UpdataRoomInfo();
                 };
                 var residentialManagePage = new RoomBinglingFloorPage(floorsCallBackAction, room);
                 MainPage.BasePageView.AddChidren(residentialManagePage);
@@ -255,7 +255,7 @@
                     room.backgroundImage = obj;
                     btnRoomBg.ImageBytes = null;//瑙e喅鏈塈mageBytes涓嶅姞杞絀magePath
                     btnRoomBg.ImagePath = room.backgroundImage;
-                    room.SaveRoomData();
+                    room.UpdataRoomInfo();
                     modifyImageAction?.Invoke();
                 };
 
@@ -283,7 +283,7 @@
             {
                 //2020-12-03 闇�瑕佽鏈�鏂扮殑鍥剧墖璺緞鍚屾鍒颁簯绔�
                 room.backgroundImage = imageUrl;
-                room.SaveRoomData();
+                room.UpdataRoomInfo();
                 modifyImageAction?.Invoke();
             };
             //涓婁紶鍥剧墖鍒颁簯绔�
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
index 6f0fee4..e088ca9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
@@ -150,8 +150,8 @@
                 ProgressBarColor = CSS_Color.MainColor,
                 OfflineProgressBarColor = CSS_Color.PromptingColor2,
                 IsOffline = aC.trait_on_off.curValue.ToString() == "off",
-                MinValue = 16,
-                MaxValue = 32,
+                MinValue = aC.trait_temp.min,
+                MaxValue = aC.trait_temp.max,
                 //IsClickable = aC.trait_on_off.curValue.ToString() == "on",
                 ArcColor = CSS_Color.BackgroundColor,
                 Progress = Convert.ToInt32(aC.trait_temp.curValue),
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
index 296a02e..41538e1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
@@ -36,7 +36,14 @@
                     }
                     bodyView.arcBar.ThumbImagePath = uAc.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png";
                     bodyView.arcBar.IsClickable = uAc.trait_on_off.curValue.ToString() == "on";
-
+                    if(uAc.trait_mode.curValue.ToString() == "fan")
+                    {
+                        bodyView.arcBar.IsClickable = false;
+                    }
+                    else
+                    {
+                        bodyView.arcBar.IsClickable = true;
+                    }
                 });
             }
             catch (Exception ex)
@@ -77,12 +84,12 @@
         {
             btnMinus.MouseUpEventHandler = (sender, e) =>
             {
-                if (aC.trait_on_off.curValue.ToString() == "off")
+                if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan")
                 {
                     return;
                 }
                 var temp = Convert.ToInt32(aC.trait_temp.curValue);
-                if (temp < 17)
+                if (temp <= aC.trait_temp.min)
                 {
                     return;
                 }
@@ -97,12 +104,12 @@
             };
             btnPlus.MouseUpEventHandler = (sender, e) =>
             {
-                if (aC.trait_on_off.curValue.ToString() == "off")
+                if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan")
                 {
                     return;
                 }
                 var temp = Convert.ToInt32(aC.trait_temp.curValue);
-                if (temp > 31)
+                if (temp >= aC.trait_temp.max)
                 {
                     return;
                 }
@@ -193,6 +200,14 @@
                 d.Add(FunctionAttributeKey.Mode, curMode);
                 Control.Ins.SendWriteCommand(aC, d);
                 dialog.Close();
+                if (aC.trait_mode.curValue.ToString() == "fan")
+                {
+                    bodyView.arcBar.IsClickable = false;
+                }
+                else
+                {
+                    bodyView.arcBar.IsClickable = true;
+                }
             };
             btn1.MouseUpEventHandler = eventHandler1;
             btn2.MouseUpEventHandler = eventHandler1;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
index d497c19..62d6a5a 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using Shared;
 
 namespace HDL_ON.UI
@@ -47,19 +48,19 @@
                     }
                 }
                 function.roomIds.Clear();
-                foreach (var room in Entity.SpatialInfo.CurrentSpatial.RoomList)
+                if (btnChooseAll.IsSelected)
                 {
-                    if (btnChooseAll.IsSelected)
+                    foreach (var room in Entity.SpatialInfo.CurrentSpatial.RoomList)
                     {
-                        function.roomIds.Add(room.roomId);
+                        if (btnChooseAll.IsSelected)
+                        {
+                            function.roomIds.Add(room.roomId);
+                        }
                     }
-                    else
-                    {
-                        function.roomIds.Remove(room.roomId);
-                    }
-                    function.SaveFunctionData(true);
                 }
-                Entity.SpatialInfo.CurrentSpatial.InitRoomFunction();
+
+                function.UpdataRoomIds();
+                Entity.SpatialInfo.CurrentSpatial.InitRoomListFunctions();
             };
         }
 
@@ -78,7 +79,7 @@
                 function.roomIds.Remove(room.roomId);
                 room.RemoveRoomFunction(function);
             }
-            function.SaveFunctionData(true);
+            function.UpdataRoomIds();
             if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count)
             {
                 btnChooseAll.IsSelected = true;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
index b88cf2b..5dde93c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -38,7 +38,7 @@
             actionRefresh = () => {
                 btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name;
                 btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName();
-                socketFunction.SaveFunctionData(true);
+                socketFunction.UpdataFuncitonInfo();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
index 718ffed..ea72033 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -18,7 +18,7 @@
             actionRefresh = () => {
                 btnFunctionName.Text = btnFunctionName_Out.Text = tv.name;
                 btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = tv.GetRoomListName();
-                tv.SaveFunctionData(true);
+                tv.UpdataFuncitonInfo();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
index 190a4b3..9f658f3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
@@ -146,8 +146,8 @@
                 ProgressBarColor = CSS_Color.MainColor ,//: CSS_Color.PromptingColor2, // 0xFFFC9C04 : CSS_Color.PromptingColor2,
                 OfflineProgressBarColor = CSS_Color.PromptingColor2,
                 IsOffline = fh.trait_on_off.curValue.ToString() == "off",
-                MinValue = 5,
-                MaxValue = 35,
+                MinValue = fh.trait_temp.min,
+                MaxValue = fh.trait_temp.max,
                 //IsClickable = fh.trait_on_off.curValue.ToString() == "on",
                 ArcColor = CSS_Color.BackgroundColor,
                 Progress = Convert.ToInt32(fh.trait_temp.curValue),
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs
index a46b8a4..2742514 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPageBLL.cs
@@ -37,7 +37,7 @@
                     {
                         function.name = name;
                         btnFunctionName.Text = name;
-                        function.SaveFunctionData(true);
+                        function.UpdataFuncitonInfo();
                     }
                 };
                 new PublicAssmebly().LoadDialog_EditParater(StringId.ChangeName, function.name, callBackAction,StringId.DeviceNameCannotBeEmpty,0,new System.Collections.Generic.List<string>());
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
index 5dfd41c..da55bd1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
@@ -66,7 +66,7 @@
             barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
             {
                 light.fadeTime = e;
-                light.SaveFunctionData(true);
+                light.UpdataFuncitonInfo();
             };
         }
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
index 0d7de11..857f841 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
@@ -19,13 +19,12 @@
                         return;
                     if (uFunction.functionType == bodyView.light.functionType && uFunction.sid == bodyView.light.sid)
                     {
-                        
+
                         if (uFunction.trait_on_off.curValue.ToString() == "on")
                         {
                             bodyView.colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png";
                             bodyView.dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
                             bodyView.btnSwitch.IsSelected = true;
-                            bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor());
                             if (!bodyView.onDimmerBar)
                             {
                                 bodyView.dimmerBar.Progress = uFunction.brightness;
@@ -40,6 +39,7 @@
                             //鑹茬洏鐨勫渾鐐归殣钘�
                             bodyView.btnWhiteRound.Visible = false;
                         }
+                        bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor());
                     }
                 }
                 catch (Exception ex)
@@ -198,7 +198,7 @@
             barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
             {
                 light.fadeTime = barFadeTime.Progress;
-                light.SaveFunctionData(true);
+                light.UpdataFuncitonInfo();
             };
         }
         /// <summary>
@@ -246,6 +246,7 @@
                 {
                     return;
                 }
+                btnWhiteRound.Visible = true;
                 btnWhiteRound.Gravity = Gravity.Center;
 
                 light.SetRGBcolor(new byte[] { 255, 255, 255 });

--
Gitblit v1.8.0