| | |
| | | Tag = "Logic"; |
| | | } |
| | | /// <summary> |
| | | /// 当前选中的功能 |
| | | /// </summary> |
| | | private Entity.Function function = null; |
| | | /// <summary> |
| | | /// 定义一个记录选中设备状态列表; |
| | | /// </summary> |
| | | private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); |
| | |
| | | |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | this.function = device; |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | |
| | | switch (device.spk) |
| | | { |
| | | //传感器 |
| | | case SPK.SensorGas: |
| | | case SPK.SensorWater: |
| | | case SPK.SensorSmoke: |
| | | case SPK.SensorGas: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorPir: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) { |
| | | keyVlaue = "alarm_status"; |
| | | } |
| | | }; |
| | | break; |
| | | case SPK.SensorDoorWindow: |
| | | case SPK.SensorDryContact: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "contact_status"; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorPir: |
| | | case SPK.SensorUtrasonic: |
| | | { |
| | | keyVlaue = "status"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "people_status"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SenesorMegahealth2: |
| | | { |
| | | keyVlaue = "action_state"; |
| | | if (!Is_SpkAttribute(keyVlaue)) |
| | | { |
| | | keyVlaue = "megahealth_state"; |
| | | } |
| | | } |
| | | break; |
| | | |
| | |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorHcho: |
| | | { |
| | | ///公司传感器key的健值是“value”; |
| | | key = "value"; |
| | | if (!Is_SpkAttribute(key)) |
| | | { |
| | | key = "value"; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 识别使用功能是否存在属性 |
| | | /// </summary> |
| | | /// <param name="key">设备属性,云雀上定义好的</param> |
| | | /// <returns></returns> |
| | | private bool Is_SpkAttribute(string key) { |
| | | ///修改新属性 |
| | | ///识别使用功能是否存在属性 |
| | | var job = this.function.GetAttribute(key); |
| | | if (job != null) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | } |