old mode 100755
new mode 100644
| | |
| | | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |