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 Trait trait_percent;
|
/// <summary>
|
/// 开关百分比
|
/// 0-100
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public int percent
|
{
|
get
|
{
|
try
|
{
|
if(trait_percent==null)
|
{
|
trait_percent = function.Find((obj) => obj.name == "percent");
|
if (trait_percent == null)
|
{
|
trait_percent = new Trait()
|
{
|
name = "percent",
|
value_key = new List<string> { "up", "down" },
|
max = 100,
|
min = 0,
|
};
|
}
|
trait_percent.value = trait_percent.min;
|
}
|
return Convert.ToInt32( trait_percent.value);
|
}
|
catch
|
{
|
MainPage.Log("percent 数据获取失败.");
|
return 0;
|
}
|
}
|
set
|
{
|
try
|
{
|
trait_percent.value = value;
|
}
|
catch
|
{
|
MainPage.Log("percent 数据刷新失败.");
|
}
|
}
|
}
|
|
}
|
}
|