From e71c57108e6dd407c2c6f0361f68150f2ff9aed5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 13:41:16 +0800
Subject: [PATCH] 版本备份
---
HDL_ON/Entity/Function/Scene.cs | 71 +++++++++++++++++++++++++++++------
1 files changed, 59 insertions(+), 12 deletions(-)
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index fa6176f..684aad0 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -223,6 +223,18 @@
return "SceneData_" + sid;
}
}
+
+ /// <summary>
+ /// 鎵ц鍊掕鏃�
+ /// </summary>
+ int countdownTime = 0;
+ /// <summary>
+ /// 閲嶇疆鎵ц鍊掕鏃�
+ /// </summary>
+ public void ResetCountdownTime()
+ {
+ countdownTime = 0;
+ }
/// <summary>
/// 鍦烘櫙鎵ц\鍊掕鏃�
/// </summary>
@@ -232,31 +244,30 @@
//鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑
if (LastExecutionTime != "" && Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) > Convert.ToDouble(Utlis.GetTimestamp(false)))
{
- int time = 0;
int.TryParse(Convert.ToInt32(
Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) - Convert.ToDouble(Utlis.GetTimestamp(false))
- ).ToString(), out time);
- if (time > 0)
+ ).ToString(), out countdownTime);
+ if (countdownTime > 0)
{
new System.Threading.Thread(() =>
{
- if (time > 0)
+ if (countdownTime > 0)
{
- while (time > 0)
+ while (countdownTime > 0)
{
Application.RunOnMainThread(() =>
{
- if (time > 60)
+ if (countdownTime > 60)
{
- btnShowDelay.Text = (time / 60).ToString() + "min" + time % 60 + "s";
+ btnShowDelay.Text = (countdownTime / 60).ToString() + "min" + countdownTime % 60 + "s";
}
else
{
- btnShowDelay.Text = time.ToString() + "s";
+ btnShowDelay.Text = countdownTime.ToString() + "s";
}
});
System.Threading.Thread.Sleep(1000);
- time--;
+ countdownTime--;
}
Application.RunOnMainThread(() =>
{
@@ -317,6 +328,13 @@
var revPack = pm.EditScene(this);
if (revPack.Code == StateCode.SUCCESS)
{
+ //閲嶇疆鎵ц鍊掕鏃�
+ this.countdownTime = 0;
+ 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)
@@ -333,10 +351,18 @@
/// </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)
{
+ this.countdownTime = 0;
var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
var tempScene = scenes.Find((obj) => obj.sid == sid);
if (tempScene != null)
@@ -412,6 +438,7 @@
/// </summary>
public string delay = "0";
+
Function _localFunction;
/// <summary>
/// 鏈湴瀵瑰簲鐨勫姛鑳�
@@ -433,7 +460,7 @@
/// 杞崲鎴愬姛鑳藉璞�
/// </summary>
/// <returns></returns>
- Function ConvertFunctionObject()
+ private Function ConvertFunctionObject()
{
var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
return localFunction;
@@ -478,12 +505,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;
}
@@ -498,6 +535,9 @@
{
public string key = "";
public string value = "";
+
+ public int max = 0;
+ public int min = 0;
/// <summary>
/// 灞炴�у悕绉版樉绀烘枃鏈�
@@ -567,6 +607,9 @@
case FunctionAttributeKey.Brightness:
us = "%";
break;
+ case FunctionAttributeKey.CCT:
+ us = "K";
+ break;
}
return us;
}
@@ -593,6 +636,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