From 50b7b7a486f56fab27c83b59eb45673c6d9f0935 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 24 二月 2021 18:33:57 +0800 Subject: [PATCH] 2021-02-24 1.新增场景上传。2.优化 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs index 1acb95e..f9cdcd3 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); -- Gitblit v1.8.0