From a715181089be0d31cd737a5367ffd02690b9d77f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 12 十一月 2020 13:36:01 +0800
Subject: [PATCH] 20201112

---
 HDL_ON/Entity/Function/FloorHeating.cs |  229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 229 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs
index cf57095..3cf3d09 100644
--- a/HDL_ON/Entity/Function/FloorHeating.cs
+++ b/HDL_ON/Entity/Function/FloorHeating.cs
@@ -1,11 +1,240 @@
 锘縰sing System;
+using System.Collections.Generic;
+
 namespace HDL_ON.Entity
 {
     public class FloorHeating : Function
     {
+        /*
+        *鍦扮儹锛歵rait: [switch, mode, set_temperature, lock]
+        *灞炴�� 鎻忚堪
+        *switch	on/off
+        *mode    day, night,away, vacation, timer
+        *set_temperature value(鍙)
+        *lock	boolean(Lock閿佸畾鎺у埗)
+        *set_ point	up,down,value
+        */
         public FloorHeating()
         {
         }
+        /// <summary>
+        /// 褰撳墠娓╁害妯″紡
+        /// 0:鎽勬皬搴�
+        /// 1:鍗庢皬搴�
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public int curTempType = 0;
+
+        /// <summary>
+        /// 宸ヤ綔妯″紡
+        /// 0:鍦扮儹妯″紡锛�1:鍦板喎妯″紡锛�
+        /// 2:鍦扮儹鍔熺巼妯″紡锛�3:鍦板喎鍔熺巼妯″紡锛�
+        /// </summary>
+        public int workMode = 0;
+        /// <summary>
+        /// 褰撳墠娓╁害妯″紡瀛楃
+        /// </summary>
+        public string tempUnitString
+        {
+            get
+            {
+                if (curTempType == 0)
+                {
+                    return "掳C";
+                }
+                else
+                {
+                    return "掳F";
+                }
+            }
+        }
+        Trait _trait_mode;
+        /// <summary>
+        /// 妯″紡灞炴��
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public Trait trait_mode
+        {
+            get
+            {
+                if (_trait_mode == null)
+                {
+                    _trait_mode = function.Find((obj) => obj.name == "mode");
+                    //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+                    if (_trait_mode == null)
+                    {
+                        _trait_mode = new Trait()
+                        {
+                            name = "mode",
+                            value_key = new List<string> { "day", "night", "away", "normal", "timer" },
+                            max = 4,
+                            min = 0,
+                        };
+                    }
+                    _trait_mode.value = _trait_mode.value_key.Count > 0 ? _trait_mode.value_key[0] : "";
+                }
+                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
+            {
+                try
+                {
+                    byte index = 0;
+                    switch (trait_mode.value.ToString())
+                    {
+                        case "day":
+                            index = 2;
+                            break;
+                        case "night":
+                            index = 3;
+                            break;
+                        case "away":
+                            index = 4;
+                            break;
+                        case "normal":
+                            index = 1;
+                            break;
+                        case "timer":
+                            index = 5;
+                            break;
+                        default:
+                            index = 0;
+                            break;
+                    }
+                    return index;
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"get curModeIndex error : {ex.Message}");
+                    return 0;
+                }
+            }
+            set
+            {
+                switch (value)
+                {
+                    case 5:
+                        trait_mode.value = "timer";
+                        break;
+                    case 1:
+                        trait_mode.value = "normal";
+                        break;
+                    case 2:
+                        trait_mode.value = "day";
+                        break;
+                    case 3:
+                        trait_mode.value = "night";
+                        break;
+                    case 4:
+                        trait_mode.value = "away";
+                        break;
+                    default:
+                        trait_mode.value = "cool";
+                        break;
+
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鏃堕棿鏍囪
+        /// 0:鐧藉ぉ锛�1:澶滄櫄
+        /// </summary>
+        public byte timeFlag = 0;
+
+        /// <summary>
+        /// 瀹ゅ唴娓╁害
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public int indoorTemp = 20;
+
+
+        Trait _trait_temp;
+        /// <summary>
+        /// 褰撳墠娓╁害
+        /// </summary>/// <summary>
+        /// 褰撳墠绌鸿皟娓╁害
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public Trait trait_temp
+        {
+            get
+            {
+                if (_trait_temp == null)
+                {
+                    _trait_temp = function.Find((obj) => obj.name == "set_temperature");
+                    //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+                    if (_trait_temp == null)
+                    {
+                        _trait_temp = new Trait()
+                        {
+                            name = "set_temperature",
+                            value_key = new List<string> { },
+                            max = 30,
+                            min = 5,
+                        };
+                    }
+                    _trait_temp.value = 16;
+                }
+                return _trait_temp;
+            }
+        }
+        /// <summary>
+        /// 褰撳墠妯″紡鐨刬con璺緞
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public string curModeImage
+        {
+            get
+            {
+                try
+                {
+                    var imagePath = "FunctionIcon/AC/HeatingIcon.png";
+                    switch (trait_mode.value)
+                    {
+                        case "day":
+                            imagePath = "FunctionIcon/AC/HeatingIcon.png";
+                            break;
+                        case "night":
+                            imagePath = "FunctionIcon/FloorHeating/NightIcon.png";
+                            break;
+                        case "away":
+                            imagePath = "FunctionIcon/FloorHeating/AwayIcon.png";
+                            break;
+                        case "timer":
+                            imagePath = "FunctionIcon/AC/AutoIcon.png";
+                            break;
+                        case "normal":
+                            imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png";
+                            break;
+                        default:
+                            imagePath = "FunctionIcon/AC/HeatingIcon.png";
+                            break;
+                    }
+                    return imagePath;
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"ac ge curModeImage error : {ex.Message}");
+                    return "FunctionIcon/AC/CoolIcon.png";
+                }
+            }
+        }
 
     }
 }

--
Gitblit v1.8.0