From c05a93ddb0714a310a31574aaf030e677d9a07b6 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 06 一月 2023 17:43:31 +0800
Subject: [PATCH] 增加多网关绑定支持

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs
index 1acb95e..ed95ec5 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs
@@ -31,6 +31,10 @@
                 scene = new Scene ();
             }
 
+            if (string.IsNullOrEmpty (scene.Sid)) {
+                scene.Sid = HDLLinkUtlis.NewSceneSid ();
+            }
+
             #region Load
             Dialog dialog = new Dialog ();
 
@@ -224,7 +228,7 @@
 
                 //澧炲姞鎴栬�呬慨鏀瑰満鏅�
                 btnSave.MouseUpEventHandler += (sender, e) => {
-                    string newScenFilePath = "GlobalScene_" + sceneTextBox.Text.Trim ()+"_"+DateTime.Now.Ticks;
+                    string newScenFilePath = "GlobalScene_" + sceneTextBox.Text.Trim ();
 
                     if (string.IsNullOrEmpty (sceneTextBox.Text.Trim ())) {
                         new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseEnterSceneName), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
@@ -264,7 +268,8 @@
                         }
                     }
                     // 鏇存柊淇敼鍚庣殑鏁版嵁
-                    IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
+                    scene.Save (newScenFilePath);//2021-02-24 
+                    //IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
                     IO.FileUtils.WriteFileByBytes (Scene.GlobalSceneFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (sceneFileList)));
                     if (action != null) {
                         action (newScenFilePath);
@@ -278,7 +283,7 @@
 
                 //澧炲姞鎴栬�呬慨鏀瑰満鏅�
                 btnSave.MouseUpEventHandler += (sender, e) => {
-                    string newScenFilePath = "RoomScene_" + room.Name + "_" + sceneTextBox.Text.Trim () + "_" + DateTime.Now.Ticks;
+                    string newScenFilePath = "RoomScene_" + room.Name + "_" + sceneTextBox.Text.Trim ();
 
                     if (string.IsNullOrEmpty (sceneTextBox.Text.Trim ())) {
                         new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseEnterSceneName), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
@@ -319,7 +324,9 @@
                         }
                     }
                     // 鏇存柊淇敼鍚庣殑鏁版嵁
-                    IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
+                    scene.Save (newScenFilePath);//2021-02-24 
+
+                    //IO.FileUtils.WriteFileByBytes (newScenFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (scene)));
                     room.Save (roomFilePath);
 
                     Room.UpdateMemorry (roomFilePath);
@@ -730,7 +737,7 @@
                                     }
                                 }
 
-
+                                System.Threading.Thread.Sleep (50);
 
                                 try {
                                     if (showTip) {
@@ -829,6 +836,7 @@
                             //112 LCD & LED浼戠湢 LCD & LED Sleep
                             //113 鏈嶅姟鍣ㄦ帶鍒�   Server control
                         }
+                        System.Threading.Thread.Sleep (50);
                     }
                 }
 

--
Gitblit v1.8.0