using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace HDL_ON.Entity
{
public class Curtain : Function
{
/*
窗帘属性列表:trait: [switch,percent,lock]
属性 描述
on_off on/off/stop;
percent 0-100;
lock boolean (Lock锁定控制)
*/
public Curtain()
{
}//percent
[Newtonsoft.Json.JsonIgnore]
public FunctionAttributes trait_percent;
///
/// 开关百分比
/// 0-100
///
[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 { "up", "down" },
max = 100,
min = 0,
};
}
trait_percent.curValue = trait_percent.min;
}
return Convert.ToInt32( trait_percent.curValue);
}
catch
{
MainPage.Log("percent 数据获取失败.");
return 0;
}
}
set
{
try
{
trait_percent.curValue = value;
}
catch
{
MainPage.Log("percent 数据刷新失败.");
}
}
}
}
}