From 270b3d8539f6b4a991a9ebf3b3a9eceb436d61d5 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 28 十月 2021 17:08:02 +0800 Subject: [PATCH] 自动化地址问题修复 --- HDL_ON/Entity/Function/Scene.cs | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 47 insertions(+), 5 deletions(-) diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs index 9399392..693db8d 100644 --- a/HDL_ON/Entity/Function/Scene.cs +++ b/HDL_ON/Entity/Function/Scene.cs @@ -86,6 +86,10 @@ /// 鏀惰棌鏍囪 /// </summary> public bool collect = false; + /// <summary> + /// 鏄惁鍏佽鍒犻櫎 + /// </summary> + public bool can_delete = true; /// <summary> /// 鍒涘缓璇ュ満鏅殑鐢ㄦ埛ID @@ -313,6 +317,11 @@ var revPack = pm.EditScene(this); if (revPack.Code == StateCode.SUCCESS) { + if(MainPage.NoLoginMode) + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); + } var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); var tempScene = scenes.Find((obj) => obj.sid == sid); if (tempScene != null) @@ -329,6 +338,13 @@ /// </summary> public string UpdateScene() { + if(MainPage.NoLoginMode) + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); + + return "0"; + } var pm = new HttpServerRequest(); var revPack = pm.EditScene(this); if (revPack.Code == StateCode.SUCCESS) @@ -408,6 +424,7 @@ /// </summary> public string delay = "0"; + Function _localFunction; /// <summary> /// 鏈湴瀵瑰簲鐨勫姛鑳� @@ -429,7 +446,7 @@ /// 杞崲鎴愬姛鑳藉璞� /// </summary> /// <returns></returns> - Function ConvertFunctionObject() + private Function ConvertFunctionObject() { var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); return localFunction; @@ -474,12 +491,22 @@ var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); if (briState != null) { - sceneFunctionInfo += briState.value + "%"; + sceneFunctionInfo += briState.value + "%" + " "; } var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent); if (perState != null) { - sceneFunctionInfo += perState.value + "%"; + sceneFunctionInfo += perState.value + "%" + " "; + } + var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT); + if(cctState != null) + { + sceneFunctionInfo += cctState.value + "%" + " "; + } + var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB); + if(rgbState!=null) + { + //sceneFunctionInfo += new cctState.value + "%" + " "; } return sceneFunctionInfo; } @@ -494,6 +521,9 @@ { public string key = ""; public string value = ""; + + public int max = 0; + public int min = 0; /// <summary> /// 灞炴�у悕绉版樉绀烘枃鏈� @@ -545,10 +575,15 @@ /// <summary> /// 灞炴�у�煎崟浣� /// </summary> - public string GetUintString() + public string GetUintString(string inputKey = "") { var us = ""; - switch (key) + var swithchString = key; + if(!string.IsNullOrEmpty(inputKey)) + { + swithchString = inputKey; + } + switch (swithchString) { case FunctionAttributeKey.SetTemp: case FunctionAttributeKey.RoomTemp: @@ -557,6 +592,9 @@ case FunctionAttributeKey.Percent: case FunctionAttributeKey.Brightness: us = "%"; + break; + case FunctionAttributeKey.CCT: + us = "K"; break; } return us; @@ -584,6 +622,10 @@ case FunctionAttributeKey.RoomTemp: case FunctionAttributeKey.Brightness: case FunctionAttributeKey.Percent: + int outT = 0; + int.TryParse(catchString,out outT); + if (outT < 0) + catchString = "0"; if (catchString == "") { catchString = "0"; -- Gitblit v1.8.0