From c404f2f369710fe72bbcc4cff2b7b8a2c11b5ff1 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 02 三月 2021 17:48:32 +0800 Subject: [PATCH] Merge branch 'master' into wjc --- Crabtree/SmartHome/HDL/Operation/Device/Scene.cs | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs index d1ef92d..e4ff071 100644 --- a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs +++ b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs @@ -9,16 +9,16 @@ /// <summary> /// 鍦烘櫙 /// </summary> -[System.Serializable] + [System.Serializable] public class Scene : Common { public readonly static string GlobalSceneFilePath = "GlobalScene"; static Scene () { - Refresh (); + Refresh (); } - public static void Refresh() + public static void Refresh () { if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (Encoding.UTF8.GetString (IO.FileUtils.ReadFile (GlobalSceneFilePath)))) { //鍒濆鍖栨埧闂村垪琛� @@ -30,10 +30,15 @@ { this.Type = DeviceType.Scene; DeviceTextID = SimpleControl.R.MyInternationalizationString.Scenes; + } - + + /// <summary> + /// 鍦烘櫙鍞竴ID + /// </summary> + public string Sid = ""; /// <summary> /// 鍦烘櫙灏忓浘鏍� @@ -44,6 +49,11 @@ /// 鍦烘櫙鐨勮儗鏅浘 /// </summary> public string BackgroundImagePath = "Scene/s1.png"; + + /// <summary> + /// 鍦烘櫙淇濆瓨璺緞 + /// </summary> + public string SceneFilePath = ""; /// <summary> /// 鏍规嵁鍦烘櫙璺緞鎭㈠鍦烘櫙瀵硅薄 @@ -75,6 +85,10 @@ /// <param name="sceneFilePath">Scence file path.</param> public void Save (string sceneFilePath) { + if(string.IsNullOrEmpty(this.SceneFilePath) || this.SceneFilePath != sceneFilePath) { + this.SceneFilePath = sceneFilePath; + } + IO.FileUtils.WriteFileByBytes (sceneFilePath, System.Text.Encoding.UTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this))); } @@ -98,6 +112,6 @@ //var ssfsdf = IO.FileUtils.ReadFile ("GlobalScene_busScene"); //var cp = CommonPage.MyEncodingUTF8.GetString (ssfsdf); } - + } } \ No newline at end of file -- Gitblit v1.8.0