From 22fcd0d263770c8371bd03ca53f097a6ec1678f7 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 24 十二月 2020 12:06:26 +0800
Subject: [PATCH] 20201224-2

---
 HDL_ON/Entity/Function/Light.cs                          |    7 +
 HDL_ON/Common/ApiUtlis.cs                                |   30 ++++---
 HDL_ON/DAL/Server/HttpServerRequest.cs                   |   15 +++
 .vs/HDL_APP_Project/xs/UserPrefs.xml                     |   34 ++++++--
 HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs |    4 
 HDL_ON/Entity/FunctionList.cs                            |  125 -------------------------------
 6 files changed, 67 insertions(+), 148 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index ab1053a..9034e6f 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,9 +1,16 @@
 锘�<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/UI/UI2/1-HomePage/HomePage.cs">
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.94B44E9C-E1BC-4BF7-812E-FC71E9B623B2" />
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/FunctionList.cs">
     <Files>
-      <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="305" Column="7" />
-      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="29" Column="18" />
+      <File FileName="HDL_ON/Common/ApiUtlis.cs" Line="220" Column="73" />
+      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="922" Column="1" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" Line="111" Column="123" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs" Line="91" Column="22" />
+      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="612" Column="29" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" Line="90" Column="1" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="621" Column="1" />
+      <File FileName="HDL_ON/Entity/Function/Light.cs" Line="206" Column="10" />
+      <File FileName="HDL_ON/Entity/FunctionList.cs" Line="197" Column="22" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -18,12 +25,11 @@
               </Node>
               <Node name="Entity" expanded="True">
                 <Node name="Function" expanded="True" />
+                <Node name="FunctionList.cs" selected="True" />
               </Node>
               <Node name="UI" expanded="True">
                 <Node name="UI2" expanded="True">
-                  <Node name="1-HomePage" expanded="True">
-                    <Node name="HomePage.cs" selected="True" />
-                  </Node>
+                  <Node name="1-HomePage" expanded="True" />
                   <Node name="2-Classification" expanded="True" />
                   <Node name="3-Intelligence" expanded="True">
                     <Node name="Scene" expanded="True" />
@@ -40,6 +46,16 @@
           </Node>
         </State>
       </Pad>
+      <Pad Id="MonoDevelop.Debugger.WatchPad">
+        <State>
+          <Value>light.RedColor</Value>
+          <Value>light.GreenColor</Value>
+          <Value>light.BlueColor</Value>
+          <Value>e2[0]</Value>
+          <Value>e2[1]</Value>
+          <Value>e2[2]</Value>
+        </State>
+      </Pad>
     </Pads>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.PinnedWatches />
@@ -48,11 +64,13 @@
     <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
   <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/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/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="90" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Light.cs" relfile="HDL_ON/Entity/Function/Light.cs" line="180" column="1" />
     </BreakpointStore>
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index c023d17..8b144ce 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -217,8 +217,6 @@
                         if (sceneList == null)
                         {
                             sceneList = new List<Scene>();
-                        }
-                        {
                             for (int i = 0; i < FunctionList.List.scenes.Count;)
                             {
                                 var localScene = FunctionList.List.scenes[i];
@@ -256,20 +254,28 @@
                         //濡傛灉鏄竴绔彛闇�瑕佹彁鍓嶄笅杞藉満鏅暟鎹紝鍚﹀垯鎺у埗涓嶄簡涓�绔彛鍦烘櫙
                         if (DB_ResidenceData.Instance.GatewayType == 0)
                         {
+                            var sceneIds = new List<string>();
                             foreach (var tempScene in FunctionList.List.scenes)
                             {
-                                var pcak = HttpRequest.GetSceneInfo(tempScene.userSceneId);
-                                if (pack.Code == StateCode.SUCCESS)
+                                sceneIds.Add(tempScene.userSceneId);
+                            }
+                            var packInfo = HttpRequest.GetSceneListInfo(sceneIds);
+                            if (packInfo.Code == StateCode.SUCCESS)
+                            {
+                                var serverTempList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(packInfo.Data.ToString());
+                                foreach (var localScene in FunctionList.List.scenes)
                                 {
-                                    var serverTempList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
-                                    var serverTemp = serverTempList.Find((obj) => obj.userSceneId == tempScene.userSceneId);
-                                    tempScene.functions = serverTemp.functions;
-                                    tempScene.SaveSceneFile();
+                                    var serverTemp = serverTempList.Find((obj) => obj.userSceneId == localScene.userSceneId);
+                                    if (serverTemp != null)
+                                    {
+                                        localScene.functions = serverTemp.functions;
+                                        localScene.SaveSceneFile();
+                                    }
                                 }
-                                else
-                                {
-                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
-                                }
+                            }
+                            else
+                            {
+                                IMessageCommon.Current.ShowErrorInfoAlter(packInfo.Code);
                             }
                         }
                         endTime = DateTime.Now.AddSeconds(5);
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index c644bdc..cebeda9 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1946,6 +1946,21 @@
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
         }
+
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙璇︽儏鍒楄〃
+        /// </summary>
+        /// <param name="seceneId">鍦烘櫙ID</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSceneListInfo(List<string> seceneIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("userSceneIds", seceneIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
+        }
+
         /// <summary>
         /// 娣诲姞鍦烘櫙
         /// </summary>
diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs
index f9843cb..34d5363 100644
--- a/HDL_ON/Entity/Function/Light.cs
+++ b/HDL_ON/Entity/Function/Light.cs
@@ -176,10 +176,10 @@
                 }
                 if (trait_color.curValue.ToString() == "{}")
                     trait_color.curValue = "255,255,255";
-                int.TryParse(trait_color.curValue.ToString().Split(",")[0], out redColor);
-                int.TryParse(trait_color.curValue.ToString().Split(",")[1], out greenColor);
-                int.TryParse(trait_color.curValue.ToString().Split(",")[2], out blueColor);
             }
+            int.TryParse(trait_color.curValue.ToString().Split(",")[0], out redColor);
+            int.TryParse(trait_color.curValue.ToString().Split(",")[1], out greenColor);
+            int.TryParse(trait_color.curValue.ToString().Split(",")[2], out blueColor);
 
             int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor;
 
@@ -202,6 +202,7 @@
             redColor = color[0];
             greenColor = color[1];
             blueColor = color[2];
+            trait_color.curValue = redColor + "," + greenColor + "," + blueColor;
         }
 
         [Newtonsoft.Json.JsonIgnore]
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 7415c31..61ba91e 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -191,7 +191,7 @@
             }
             if (filePath.StartsWith("SceneData_"))
             {
-                var sceneDataBytes = Common.FileUtlis.Files.ReadFile(filePath);
+                var sceneDataBytes = FileUtlis.Files.ReadFile(filePath);
                 var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes);
                 var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString);
                 List.scenes.Add(tempScene);
@@ -376,129 +376,6 @@
             }
             return pack.Code;
         }
-
-        /// <summary>
-        /// 涓嬫潵浜戠璁惧鏁版嵁
-        /// </summary>
-        public void DownloadFunctionList()
-        {
-            new Thread(() =>
-            {
-                var pm = new HttpServerRequest();
-                var pack = pm.GetDeviceList();
-                if (pack.Code == StateCode.SUCCESS)
-                {
-                    var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(pack.Data.ToString());
-                    if (deviceList != null)
-                    {
-                        if (List.GetDeviceFunctionList().Count > 0)
-                        {
-                            for (int i = 0; i < List.GetDeviceFunctionList().Count;)
-                            {
-                                var localFunction = List.GetDeviceFunctionList()[i];
-                                if (localFunction.functionCategory == FunctionCategory.Music)
-                                {
-                                    i++;
-                                    continue;
-                                }
-                                var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId);
-                                if (newFunction == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍
-                                {
-                                    List.DeleteFunction(localFunction);
-                                }
-                                else
-                                {
-                                    MainPage.Log($"deviceType:{localFunction.spk} local:{localFunction.modifyTime} server:{newFunction.modifyTime}");
-                                    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.SaveFunctionFile();
-                                    }
-                                    deviceList.list.Remove(newFunction);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
-                                }
-                            }
-                        }
-                        //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
-                        foreach (var newFunction in deviceList.list)
-                        {
-                            newFunction.SaveFunctionFile();
-                            List.IniFunctionList(newFunction.savePath);
-                        }
-                    }
-                    //MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁:\r\n{ pack.Data.ToString()}");
-                }
-                else
-                {
-                    MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:\r\nCode:{pack.Code};  Msg:{pack.message}");
-                }
-            })
-            { IsBackground = true }.Start();
-        }
-
-        /// <summary>
-        /// 涓嬭浇浜戠鍦烘櫙鏁版嵁
-        /// </summary>
-        public void DownloadSceneList()
-        {
-            new Thread(() =>
-            {
-                var pm = new HttpServerRequest();
-                var pack = pm.GetSceneList();
-                if(pack.Code == StateCode.SUCCESS)
-                {
-                    //MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁:\r\n{pack.Data.ToString()}");
-                    var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
-                    if (sceneList != null)
-                    {
-                        for (int i=0;i<List.scenes.Count;)
-                        {
-                            var localScene = List.scenes[i];
-                            if (localScene == null)
-                            {
-                                List.scenes.Remove(localScene);
-                                continue;
-                            }
-                            var newScene = sceneList.Find((obj) => obj.userSceneId == localScene.userSceneId);
-                            if (newScene == null)//濡傛灉浜戠鏈�鏂版暟鎹病鏈夎鏉℃暟鎹紝鍒欐湰鍦伴渶瑕佸垹鎺夎鏁版嵁璁板綍
-                            {
-                                List.DeleteScene(localScene,false);
-                            }
-                            else
-                            {
-                                i++;
-                                if (localScene.modifyTime != newScene.modifyTime)
-                                {
-                                    localScene.name = newScene.name;
-                                    localScene.collect = newScene.collect;
-                                    localScene.modifyTime = newScene.modifyTime;
-                                    localScene.roomIds = newScene.roomIds;
-                                    localScene.SaveSceneFile();
-                                }
-                                sceneList.Remove(newScene);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
-                            }
-                        }
-                        //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
-                        foreach (var newScene in sceneList)
-                        {
-                            newScene.SaveSceneFile();
-                            List.scenes.Add(newScene);
-                        }
-                    }
-                }
-                else
-                {
-                    MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:\r\nCode:{pack.Code};  Msg:{pack.message}");
-                }
-            })
-            { IsBackground = true }.Start();
-        }
-
-
 
         /// <summary>
         /// 鍒犻櫎鍦烘櫙
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 3d80e11..015aaaf 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -85,7 +85,9 @@
                     d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
                     if(fadeTime!= null)
                     {
-                        d.Add(FunctionAttributeKey.FadeTime, fadeTime.curValue.ToString());
+                        int result = 0;
+                        int.TryParse(fadeTime.curValue.ToString(), out result);
+                        d.Add(FunctionAttributeKey.FadeTime, result.ToString());
                     }
                     Control.Ins.SendWriteCommand(function, d);
                 })

--
Gitblit v1.8.0