wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
HDL_ON/Entity/Function/Curtain.cs
old mode 100755 new mode 100644
@@ -4,68 +4,12 @@
namespace HDL_ON.Entity
{
    public class Curtain : Function
    public class Curtain
    {
        /*
        窗帘属性列表:trait: [switch,percent,lock]
        属性   描述
        on_off   on/off/stop;
        percent   0-100;
        lock   boolean (Lock锁定控制)
        */
        public Curtain()
        public int GetPercent(Function function)
        {
        }//percent
        [Newtonsoft.Json.JsonIgnore]
        public FunctionAttributes trait_percent;
        /// <summary>
        /// 开关百分比
        /// 0-100
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public int percent
        {
            get
            {
                try
                {
                    if(trait_percent==null)
                    {
                        trait_percent = attributes.Find((obj) => obj.key == "percent");
                        if (trait_percent == null)
                        {
                            trait_percent = new FunctionAttributes()
                            {
                                key = "percent",
                                value = new List<string> { "up", "down" },
                                max = 100,
                                min = 0,
                                curValue = 0
                            };
                        }
                        if (trait_percent.curValue.ToString() == "{}")
                            trait_percent.curValue = 0;
                    }
                    return Convert.ToInt32( trait_percent.curValue);
                }
                catch
                {
                    MainPage.Log("percent 数据获取失败.");
                    return 0;
                }
            }
            set
            {
                try
                {
                    trait_percent.curValue = value;
                }
                catch
                {
                    MainPage.Log("percent 数据刷新失败.");
                }
            }
            return Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Percent));
        }
    }
}