| | |
| | | } |
| | | } |
| | | break; |
| | | //水浸传感器 |
| | | case SPK.SensorWater: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //烟雾传感器 |
| | | case SPK.SensorSmoke: |
| | | //燃气传感器 |
| | | case SPK.SensorGas: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //干接点 |
| | | case SPK.SensorDryContact: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | |
| | | } |
| | | break; |
| | | //红外珊栏传感器 |
| | | case SPK.SensorShanLan: |
| | | //红外对射传感器 |
| | | case SPK.SensorDuiShe: |
| | | //红外移动传感器 |
| | | case SPK.SensorPir: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorDoorWindow: { |
| | | //门窗传感器 |
| | | case SPK.SensorDoorWindow: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnText.TextID = StringId.kaiqiandbihe; |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | DeviceView(device, view.btnState, StringId.kaiqi , StringId.bihe); |
| | | DeviceView(device, view.btnState, StringId.kaiqi, StringId.bihe); |
| | | }; |
| | | if (edit) |
| | | { |
| | |
| | | } |
| | | } |
| | | break; |
| | | //超声波传感器 |
| | | case SPK.SensoruUtrasonic: |
| | | { |
| | | |
| | | |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnText.TextID = StringId.yourenandwuren; |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, view.btnState, view1.btnState, null, null); |
| | | } |
| | | } |
| | | break; |
| | | //毫米波传感器 |
| | | case SPK.SenesorMegahealth: |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnText.TextID = StringId.mubiaozhuangtai ;//目标状态 |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | DeviceView(device, view.btnState, StringId.wuren, StringId.diedao); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, view.btnState, null, null, null); |
| | | } |
| | | } |
| | | break; |
| | |
| | | return; |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | if (MainView.IsGatewayType) |
| | | { //A网关 |
| | | var addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | //一端口网关 |
| | | var onePortAutomation = new OnePortAutomation(); |
| | | MainPage.BasePageView.AddChidren(onePortAutomation); |
| | | onePortAutomation.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | |
| | | keyVlaue = "status"; |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth: |
| | | { |
| | | keyVlaue = "action_state"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | switch (intValue) |
| | |
| | | value = "off"; |
| | | } |
| | | break; |
| | | case StringId.youren: { |
| | | case StringId.youren: |
| | | { |
| | | value = "true"; |
| | | } |
| | | break; |
| | | case StringId.wuren: { |
| | | value = "false"; |
| | | case StringId.wuren: |
| | | { |
| | | if (device.spk == SPK.SenesorMegahealth) |
| | | { |
| | | value = "uninhabited"; |
| | | } |
| | | else |
| | | { |
| | | value = "false"; |
| | | } |
| | | } |
| | | break; |
| | | case StringId.kaiqi: |
| | |
| | | value = "close"; |
| | | } |
| | | break; |
| | | case StringId.zaixian: { |
| | | case StringId.zaixian: |
| | | { |
| | | keyVlaue = "dismantle"; |
| | | value = "true"; |
| | | };break; |
| | | }; break; |
| | | case StringId.buzaixian: |
| | | { |
| | | keyVlaue = "dismantle"; |
| | | value = "false"; |
| | | }; break; |
| | | case StringId.diedao: |
| | | { |
| | | value = "fall"; |
| | | }; break; |
| | | } |
| | | //显示文本 |
| | | button.TextID = intValue; |
| | | selectedState = device.spk + "_" + value; |
| | | AddDictionary(keyVlaue, value); |
| | | AddDictionary(keyVlaue, value, "string"); |
| | | |
| | | }); |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="KeyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="selectedValue">状态值</param> |
| | | private void AddDictionary(string KeyValue, string selectedValue) |
| | | /// <param name="data_type">类型</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | private void AddDictionary(string KeyValue, string selectedValue,string data_type,string comparator="=") |
| | | { |
| | | //数据封装 |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.dictionary(dic, "data_type", data_type); |
| | | LogicMethod.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, dic); |
| | | AddDictionaryList(KeyValue, comparator,dic); |
| | | } |
| | | /// <summary> |
| | | /// 更新数据列表 |
| | | /// </summary> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <param name="dictionary">添加选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) |
| | | private void AddDictionaryList(string keyValue,string comparator, Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicSateteList.Count; i++) |
| | | { |
| | | var dic = dicSateteList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |