tzy
2021-05-30 1c63243a7bcc330b7293cc8d5ec81c4c52018196
HDL_ON/Entity/Function/Scene.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON.UI;
using Shared;
namespace HDL_ON.Entity
@@ -83,6 +84,11 @@
        /// </summary>
        public bool collect = false;
        /// <summary>
        /// 创建该场景的用户ID
        /// </summary>
        public string userId = "";
        ///// <summary>
        ///// 场景背景
        ///// </summary>
@@ -137,13 +143,14 @@
                sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2");
                if (sTimeSpan.Length > 8)
                if (sTimeSpan.Length >= 8)
                {
                    sTimeSpan = sTimeSpan.Substring(0, 8);
                }
                else
                {
                    sTimeSpan = "00000000";
                    sTimeSpan = Guid.NewGuid().ToString().Substring(0, 8);
                    //sTimeSpan = "00000000";
                }
                sceneId = sOidBeginsWith + sTimeSpan;
@@ -339,7 +346,10 @@
        /// </summary>
        public string GetDelayText()
        {
            string text = "";
            var delayInt = 0;
            int.TryParse(delay,out delayInt);
            string text = (delayInt / 60)+Language.StringByID(StringId.m)+(delayInt % 60)+Language.StringByID(StringId.s);
            return text;
            switch (delay)
            {
                case "0":
@@ -368,6 +378,8 @@
        /// 云端数据修改的最后时间
        /// </summary>
        public string modifyTime = "";
    }
    /// <summary>
    /// 场景功能对象
@@ -409,6 +421,54 @@
            return localFunction;
        }
        /// <summary>
        /// 解析场景功能数据
        /// </summary>
        /// <param name="sceneFunction"></param>
        public string GetFunctionScnenInfo()
        {
            var sceneFunctionInfo = "";
            foreach (var sfs in status)
            {
                if (sfs.key == FunctionAttributeKey.OnOff)
                {
                    if (sfs.value == "off")
                        return Language.StringByID(StringId.Close);
                }
            }
            sceneFunctionInfo += Language.StringByID(StringId.Open) + " ";
            var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
            var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
            var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
            if (modeState != null)
            {
                sceneFunctionInfo += modeState.GetValueText() + " ";
            }
            if (tempState != null)
            {
                sceneFunctionInfo += tempState.GetValueText() + " ";
                sceneFunctionInfo += tempState.GetUintString();
            }
            if (fanState != null)
            {
                sceneFunctionInfo += fanState.GetValueText() + " ";
            }
            var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
            if (briState != null)
            {
                sceneFunctionInfo += briState.value + "%";
            }
            var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
            if (perState != null)
            {
                sceneFunctionInfo += perState.value + "%";
            }
            return sceneFunctionInfo;
        }
    }
    /// <summary>