From bb6ad792b598927a5459a5fb6f6c27fb1aa9e94e Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 17 十二月 2020 14:06:36 +0800 Subject: [PATCH] 20201217-1 --- HDL_ON/Entity/Function/FloorHeating.cs | 272 ++++++++++++++++++++---------------------------------- 1 files changed, 102 insertions(+), 170 deletions(-) diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs index f5bb84e..f218595 100644 --- a/HDL_ON/Entity/Function/FloorHeating.cs +++ b/HDL_ON/Entity/Function/FloorHeating.cs @@ -6,12 +6,13 @@ public class FloorHeating : Function { /* - *鍦扮儹锛歵rait: [switch, mode, temperature, lock] + *鍦扮儹锛歵rait: [switch, mode, set_temp, lock] *灞炴�� 鎻忚堪 *switch on/off *mode day, night,away, vacation, timer - *temperature up,down,value + *set_temp value *lock boolean(Lock閿佸畾鎺у埗) + *set_ point up,down,value */ public FloorHeating() { @@ -33,7 +34,7 @@ /// <summary> /// 褰撳墠娓╁害妯″紡瀛楃 /// </summary> - public string curTempTypeString + public string tempUnitString { get { @@ -47,20 +48,49 @@ } } } + FunctionAttributes _trait_mode; /// <summary> - /// 褰撳墠妯″紡 + /// 妯″紡灞炴�� /// </summary> [Newtonsoft.Json.JsonIgnore] - public string curMode = "day"; + public FunctionAttributes trait_mode + { + get + { + if (_trait_mode == null) + { + _trait_mode = attributes.Find((obj) => obj.key == "mode"); + //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� + if (_trait_mode == null) + { + _trait_mode = new FunctionAttributes() + { + key = "mode", + value = new List<string> { "day", "night", "away", "normal", "timer" }, + max = 4, + min = 0, + }; + } + if(_trait_mode.curValue.ToString() == "{}") + { + _trait_mode.curValue = "day"; + } + } + return _trait_mode; + } + } + /// <summary> /// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴� /// </summary> + [Newtonsoft.Json.JsonIgnore] public Dictionary<string, byte> modeTemp = new Dictionary<string, byte>(); /// <summary> /// 褰撳墠妯″紡绱㈠紩 /// bus鎺у埗鍛戒护浣跨敤 /// </summary> + [Newtonsoft.Json.JsonIgnore] public byte curModeIndex { get @@ -68,7 +98,7 @@ try { byte index = 0; - switch (curMode) + switch (trait_mode.curValue.ToString()) { case "day": index = 2; @@ -79,7 +109,7 @@ case "away": index = 4; break; - case "ordinary": + case "normal": index = 1; break; case "timer": @@ -102,62 +132,24 @@ switch (value) { case 5: - curMode = "timer"; + trait_mode.curValue = "timer"; break; case 1: - curMode = "ordinary"; + trait_mode.curValue = "normal"; break; case 2: - curMode = "day"; + trait_mode.curValue = "day"; break; case 3: - curMode = "night"; + trait_mode.curValue = "night"; break; case 4: - curMode = "away"; + trait_mode.curValue = "away"; break; default: - curMode = "cool"; + trait_mode.curValue = "cool"; break; - } - } - } - - [Newtonsoft.Json.JsonIgnore] - public Trait trait_mode; - /// <summary> - /// 妯″紡鍒楄〃 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public List<string> modeList - { - get - { - try - { - if (trait_mode == null) - { - trait_mode = propertList.Find((obj) => obj.attri == "mode"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (trait_mode == null) - { - trait_mode = new Trait() - { - attri = "mode", - value = new List<string> { "day", "night", "away", "timer", "ordinary" }, - max = 4, - min = 0, - }; - } - trait_mode.curValues = trait_mode.value[trait_mode.min]; - } - return trait_mode.value; - } - catch (Exception ex) - { - MainPage.Log($"ac get mode error : {ex.Message}"); - return new List<string> { "day", "night", "away", "timer", "ordinary" }; } } } @@ -168,138 +160,78 @@ /// </summary> public byte timeFlag = 0; + FunctionAttributes _trait_IndoorTemp; /// <summary> /// 瀹ゅ唴娓╁害 /// </summary> [Newtonsoft.Json.JsonIgnore] - public int indoorTemp = 20; - /// <summary> - /// 褰撳墠娓╁害 - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public int curTemp + public FunctionAttributes trait_IndoorTemp { get { - switch (curMode) + if (_trait_IndoorTemp == null) { - case "day": - if (!modeTemp.ContainsKey("day")) + _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp); + //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� + if (_trait_IndoorTemp == null) + { + _trait_IndoorTemp = new FunctionAttributes() { - modeTemp.Add("day", 20); - } - return modeTemp["day"]; - case "night": - if (!modeTemp.ContainsKey("night")) - { - modeTemp.Add("night", 20); - } - return modeTemp["night"]; - case "away": - if (!modeTemp.ContainsKey("away")) - { - modeTemp.Add("away", 20); - } - return modeTemp["away"]; - case "ordinary": - if (!modeTemp.ContainsKey("ordinary")) - { - modeTemp.Add("ordinary", 20); - } - return modeTemp["ordinary"]; - case "timer": - if (timeFlag == 0) - { - if (!modeTemp.ContainsKey("day")) - { - modeTemp.Add("day", 20); - } - return modeTemp["day"]; - } - else - { - if (!modeTemp.ContainsKey("night")) - { - modeTemp.Add("night", 20); - } - return modeTemp["night"]; - } + key = FunctionAttributeKey.IndoorTemp, + value = new List<string> { }, + max = 30, + min = 0, + }; + if (_trait_IndoorTemp.curValue.ToString() == "{}") + _trait_IndoorTemp.curValue = 0; + } } - return 20; - } - set - { - switch (curMode) + //if (_trait_IndoorTemp.curValue.ToString().Length > 3) { - case "day": - if (!modeTemp.ContainsKey("day")) - { - modeTemp.Add("day", (byte)value); - } - else - { - modeTemp["day"] = (byte)value; - } - return; - case "night": - if (!modeTemp.ContainsKey("night")) - { - modeTemp.Add("night", (byte)value); - } - else - { - modeTemp["night"] = (byte)value; - } - break; - case "away": - if (!modeTemp.ContainsKey("away")) - { - modeTemp.Add("away", (byte)value); - } - else - { - modeTemp["away"] = (byte)value; - } - break; - case "ordinary": - if (!modeTemp.ContainsKey("ordinary")) - { - modeTemp.Add("ordinary", (byte)value); - } - else - { - modeTemp["ordinary"] = (byte)value; - } - break; - case "timer": - if (timeFlag == 0) - { - if (!modeTemp.ContainsKey("day")) - { - modeTemp.Add("day", (byte)value); - } - else - { - modeTemp["day"] = (byte)value; - } - } - else - { - if (!modeTemp.ContainsKey("night")) - { - modeTemp.Add("night", (byte)value); - } - else - { - modeTemp["night"] = (byte)value; - } - } - break; + var vv = Convert.ToDouble(_trait_IndoorTemp.curValue); + _trait_IndoorTemp.curValue = Convert.ToInt32(vv); } + return _trait_IndoorTemp; } } - + + FunctionAttributes _trait_temp; + /// <summary> + /// 褰撳墠娓╁害 + /// </summary>/// <summary> + /// 褰撳墠绌鸿皟娓╁害 + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public FunctionAttributes trait_temp + { + get + { + if (_trait_temp == null) + { + _trait_temp = attributes.Find((obj) => obj.key == "set_temp"); + //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� + if (_trait_temp == null) + { + _trait_temp = new FunctionAttributes() + { + key = "set_temp", + value = new List<string> { }, + max = 30, + min = 5, + }; + } + if(_trait_temp.curValue.ToString() == "{}") + _trait_temp.curValue = 16; + } + //if (_trait_temp.curValue.ToString().Length > 3) + { + var vv = Convert.ToDouble(_trait_temp.curValue); + _trait_temp.curValue = Convert.ToInt32(vv); + } + return _trait_temp; + } + } /// <summary> /// 褰撳墠妯″紡鐨刬con璺緞 /// </summary> @@ -311,7 +243,7 @@ try { var imagePath = "FunctionIcon/AC/HeatingIcon.png"; - switch (curMode) + switch (trait_mode.curValue) { case "day": imagePath = "FunctionIcon/AC/HeatingIcon.png"; @@ -325,7 +257,7 @@ case "timer": imagePath = "FunctionIcon/AC/AutoIcon.png"; break; - case "ordinary": + case "normal": imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png"; break; default: -- Gitblit v1.8.0