From f534d41c36d5895322bf691784a10435b64609fe Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 25 十二月 2020 13:52:00 +0800
Subject: [PATCH] 修复添加、删除楼层时候,界面刷新异常问题

---
 HDL_ON/Entity/FunctionList.cs |  125 -----------------------------------------
 1 files changed, 1 insertions(+), 124 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 4429070..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.SaveSceneData(false);
-                                }
-                                sceneList.Remove(newScene);//鎿嶄綔瀹岀殑鏁版嵁娓呯悊鎺夛紝鍓╀笅鐨勫氨鏄柊澧炵殑鍔熻兘
-                            }
-                        }
-                        //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
-                        foreach (var newScene in sceneList)
-                        {
-                            newScene.SaveSceneData(false);
-                            List.scenes.Add(newScene);
-                        }
-                    }
-                }
-                else
-                {
-                    MainPage.Log($"璇诲彇浜戠鍦烘櫙鏁版嵁澶辫触:\r\nCode:{pack.Code};  Msg:{pack.message}");
-                }
-            })
-            { IsBackground = true }.Start();
-        }
-
-
 
         /// <summary>
         /// 鍒犻櫎鍦烘櫙

--
Gitblit v1.8.0