From 792ca2a402feb952ef890d653f2e049c1230baf1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 18:48:33 +0800
Subject: [PATCH] 1111
---
HDL_ON/Entity/Function/Scene.cs | 143 +++++++++++++++++++++++++++++++++--------------
1 files changed, 100 insertions(+), 43 deletions(-)
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 8cc2700..639997f 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -27,15 +27,15 @@
public Scene()
{
sid = NewSid();
- if (!DB_ResidenceData.residenceData.CheckWhetherGatewayIdIsNull())
+ if (!DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
{
- gatewayId = DB_ResidenceData.residenceData.HomeGateway.gatewayId;
+ gatewayId = DB_ResidenceData.Instance.HomeGateway.gatewayId;
}
}
/// <summary>
/// 浜戠鍞竴ID
/// </summary>
- public string userSceneId = "";
+ public string userSceneId = null;
/// <summary>
/// 鍦烘櫙sid
/// </summary>
@@ -63,37 +63,37 @@
/// <summary>
/// 寤舵椂
/// </summary>
- public int delay = 0;
- /// <summary>
- /// 寤舵椂鏄剧ず鐨勬枃鏈�
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public string delayText
- {
- get
- {
- string text = "";
- switch (delay)
- {
- case 0:
- text = Language.StringByID(StringId.NoDelay);
- break;
- case 30:
- text = "30s";
- break;
- case 60:
- text = "1min";
- break;
- case 120:
- text = "2min";
- break;
- case 300:
- text = "5min";
- break;
- }
- return text;
- }
- }
+ public string delay = "0";
+ ///// <summary>
+ ///// 寤舵椂鏄剧ず鐨勬枃鏈�
+ ///// </summary>
+ //[Newtonsoft.Json.JsonIgnore]
+ //public string delayText
+ //{
+ // get
+ // {
+ // string text = "";
+ // switch (delay)
+ // {
+ // case 0:
+ // text = Language.StringByID(StringId.NoDelay);
+ // break;
+ // case 30:
+ // text = "30s";
+ // break;
+ // case 60:
+ // text = "1min";
+ // break;
+ // case 120:
+ // text = "2min";
+ // break;
+ // case 300:
+ // text = "5min";
+ // break;
+ // }
+ // return text;
+ // }
+ //}
/// <summary>
/// 鍦烘櫙鍒嗙粍
@@ -223,7 +223,7 @@
}
if (roomNameList == "" )
{
- roomNameList = Shared.Language.StringByID(StringId.WholeHouseScene);
+ roomNameList = Shared.Language.StringByID(StringId.WholeZone);
}
return roomNameList;
}
@@ -256,6 +256,66 @@
MainPage.Log($"Save Scene Data : {savePath}");
}
}
+ /// <summary>
+ /// 鏀惰棌鍦烘櫙
+ /// </summary>
+ /// <returns></returns>
+ public string CollectScene()
+ {
+ var pm = new HttpServerRequest();
+ if (this.collect)
+ {
+ var revPack = pm.CollectScene(this.userSceneId);
+ return revPack;
+ }
+ else
+ {
+ var revPack = pm.CancelCollectScene(this.userSceneId);
+ return revPack;
+ }
+ }
+
+ /// <summary>
+ /// 缂栬緫鍦烘櫙
+ /// </summary>
+ public string EditScene()
+ {
+ var pm = new HttpServerRequest();
+ var revPack = pm.EditScene(this);
+ if (revPack.Code == StateCode.SUCCESS)
+ {
+ var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
+ var tempScene = scenes.Find((obj) => obj.sid == sid);
+ if (tempScene != null)
+ {
+ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene));
+ Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+ }
+ }
+ return revPack.Code;
+ }
+
+ /// <summary>
+ /// 淇敼鍦烘櫙
+ /// </summary>
+ public string UpdateScene()
+ {
+ var pm = new HttpServerRequest();
+ var revPack = pm.EditScene(this);
+ if (revPack.Code == StateCode.SUCCESS)
+ {
+ var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
+ var tempScene = scenes.Find((obj) => obj.sid == sid);
+ if (tempScene != null)
+ {
+ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene));
+ Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+ }
+ }
+ return revPack.Code;
+ }
+
+
/// <summary>
/// 涓婁紶鏁版嵁鍒颁簯绔�
@@ -316,10 +376,11 @@
/// 鏈湴瀵瑰簲鐨勫姛鑳�
/// </summary>
[Newtonsoft.Json.JsonIgnore]
- public Function localFunction {
+ public Function localFunction
+ {
get
{
- if(_localFunction == null)
+ if (_localFunction == null)
{
_localFunction = ConvertFunctionObject();
}
@@ -333,14 +394,10 @@
/// <returns></returns>
Function ConvertFunctionObject()
{
- var localFunction = DB_ResidenceData.functionList.GetAllDeviceFunctionList().Find((obj) => obj.sid == sid);
- foreach (var s in status)
- {
- localFunction.attributes.Add(new FunctionAttributes() { key = s.key, curValue = s.value, value = new List<string>() { s.value } });
- }
+ var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
return localFunction;
}
-
+
}
/// <summary>
--
Gitblit v1.8.0