| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | break; |
| | | case DeviceType.IASZone: |
| | |
| | | break; |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | if (edit && devices != null) |
| | | { |
| | | //温度值 |
| | | str1 = devices["AttriButeData1"]; |
| | | //比较关系值 |
| | | str2 = devices["Range"]; |
| | | |
| | | } |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { common }); |
| | | |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common, devices); |
| | | } |
| | | else |
| | | { |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); |
| | | } |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | completeView.Show(4); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.TemperatureShow(completeView.fraView, common, str2, str1, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(deviceConditionsInfo, "Range", relationValueStr); |
| | | }); |
| | | |
| | | |
| | | //编辑时的状态值 |
| | | string str1 = ""; |
| | | string str2 = ""; |
| | | string str3 = ""; |
| | | if (edit && devices != null) |
| | | { |
| | | //温度值 |
| | | str1 = devices["AttriButeData1"]; |
| | | //比较关系值 |
| | | str2 = devices["Range"]; |
| | | |
| | | } |
| | | var temperatureSensor = common as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | str3 = "℃"; |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); |
| | | } |
| | | else |
| | | { |
| | | str3 = "%"; |
| | | Send.dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); |
| | | } |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeId", "0"); |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0"); |
| | | completeView.Show(4); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.TemperatureShow(completeView.fraView, str3, str2, str1, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(deviceConditionsInfo, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(deviceConditionsInfo, "Range", relationValueStr); |
| | | }); |
| | | } |
| | | } |
| | | break; |
| | | ///调光灯光 |
| | |
| | | var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; |
| | | Send.dictionary(switchdictionary, "Data1", lightbrightnessvalue.ToString()); |
| | | }; |
| | | |
| | | ///取消事件 |
| | | closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | Send.dictionary(switchdictionary, "TaskType", "1"); |
| | | Send.dictionary(switchdictionary, "Data1", "0");//默认值 |
| | | }; |
| | | |
| | | //取反 |
| | | takebackView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | completeView.Btncomplete.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// <summary> |
| | | /// 空调模式的状态 |
| | | /// </summary> |
| | | /// <param name="modestring"></param> |
| | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器View(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="dic"></param> |
| | | private static void AirSonser(FrameLayout flMain,string SelectedDeviceStatus,bool edit,CommonDevice common, Dictionary<string, string> dic=null) { |
| | | flMain.RemoveAll(); |
| | | if (edit&&dic!=null) { |
| | | AirProperty(flMain, dic, common,"", edit, SelectedDeviceStatus); |
| | | } |
| | | else |
| | | { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | var list0 = publicInterface.GetViewList("空气质量传感器"); |
| | | publicInterface.SingleSelectionShow(flMain, list0, MyInternationalizationString.airqualitysensor, "", (tagText) => |
| | | { |
| | | flMain.RemoveAll(); |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | AirProperty(flMain, dic, common,tagText, edit, SelectedDeviceStatus); |
| | | }, () => { flMain.RemoveFromParent(); }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器属性值(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="dic"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="tagText"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | private static void AirProperty(FrameLayout flMain, Dictionary<string, string> dic,CommonDevice common,string tagText,bool edit, string SelectedDeviceStatus) { |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | string range = ""; |
| | | string stateText = ""; |
| | | if (edit&& dic!=null) |
| | | { |
| | | range = dic["Range"]; |
| | | switch (dic["Cluster_ID"]) |
| | | { |
| | | case "1066": |
| | | { |
| | | if (dic["AttriButeId"] == "57344") |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.kongqizhiliang); |
| | | switch (dic["AttriButeData1"]) |
| | | { |
| | | |
| | | case "1": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.you); |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.liang); |
| | | } |
| | | break; |
| | | case "3": |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.cha); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.pm25); |
| | | ///Pm2.5 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 30) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmyou); |
| | | } |
| | | else if (36 < intValue && intValue < 75) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmliang); |
| | | } |
| | | else if (76 < intValue && intValue < 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmqingdu); |
| | | } |
| | | else if (intValue > 115) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.pmzhongdu); |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case "1037": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.co2); |
| | | ///co2 |
| | | int intValue = int.Parse(dic["AttriButeData1"]); |
| | | if (0 < intValue && intValue < 1000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2qingxin); |
| | | } |
| | | else if (1000 < intValue && intValue < 2000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2huizhuo); |
| | | } |
| | | else if (2000 < intValue && intValue < 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2queyang); |
| | | } |
| | | else if (intValue > 5000) |
| | | { |
| | | stateText = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang); |
| | | } |
| | | } |
| | | break; |
| | | case "1026": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensortemperature); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | case "1029": |
| | | { |
| | | tagText = Language.StringByID(MyInternationalizationString.sensorhumidity); |
| | | stateText = dic["AttriButeData1"]; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | Dictionary<string, string> airqualitysensorDic = new Dictionary<string, string>(); |
| | | Send.dictionary(airqualitysensorDic, "Type", "1"); |
| | | Send.dictionary(airqualitysensorDic, "IsValid", "1"); |
| | | Send.dictionary(airqualitysensorDic, "MacAddr", common.DeviceAddr); |
| | | Send.dictionary(airqualitysensorDic, "Epoint", common.DeviceEpoint.ToString()); |
| | | if (tagText == Language.StringByID(MyInternationalizationString.kongqizhiliang)) |
| | | { |
| | | |
| | | var list1 = publicInterface.GetViewList("空气质量"); |
| | | publicInterface.SingleSelectionShow(flMain, list1, MyInternationalizationString.airqualitysensor, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.you)) |
| | | { |
| | | valuaStr = "1"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.liang)) |
| | | { |
| | | valuaStr = "2"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.cha)) |
| | | { |
| | | valuaStr = "3"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1066"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "57344"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.pm25)) |
| | | { |
| | | var list2 = publicInterface.GetViewList("pm2.5"); |
| | | publicInterface.SingleSelectionShow(flMain, list2, MyInternationalizationString.pm25, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.pmyou)) |
| | | { |
| | | valuaStr = "18"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmliang)) |
| | | { |
| | | valuaStr = "54"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmqingdu)) |
| | | { |
| | | valuaStr = "105"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.pmzhongdu)) |
| | | { |
| | | valuaStr = "130"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1066"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.co2)) |
| | | { |
| | | |
| | | var list2 = publicInterface.GetViewList("co2"); |
| | | publicInterface.SingleSelectionShow(flMain, list2, MyInternationalizationString.co2, stateText, (strText) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | string valuaStr = ""; |
| | | if (strText == Language.StringByID(MyInternationalizationString.co2qingxin)) |
| | | { |
| | | valuaStr = "500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2huizhuo)) |
| | | { |
| | | valuaStr = "1500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2queyang)) |
| | | { |
| | | valuaStr = "2500"; |
| | | } |
| | | else if (strText == Language.StringByID(MyInternationalizationString.co2yanzhongqueyang)) |
| | | { |
| | | valuaStr = "5500"; |
| | | } |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1037"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", valuaStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", "1"); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensortemperature)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "℃", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1026"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", relationValueStr); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | |
| | | |
| | | }, () => |
| | | { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else if (tagText == Language.StringByID(MyInternationalizationString.sensorhumidity)) |
| | | { |
| | | //编辑时的状态值 |
| | | string str1 = range; |
| | | string str2 = stateText; |
| | | publicInterface.TemperatureShow1(flMain, tagText, "%", str1, str2, (relationValueStr, tempValueStr) => |
| | | { |
| | | SelectedDeviceStatus = "TemperatureSensor"; |
| | | Send.dictionary(airqualitysensorDic, "Cluster_ID", "1029"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeId", "0"); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData1", tempValueStr); |
| | | Send.dictionary(airqualitysensorDic, "AttriButeData2", "0"); |
| | | Send.dictionary(airqualitysensorDic, "Range", relationValueStr); |
| | | AddDic(flMain, SelectedDeviceStatus, edit, common, airqualitysensorDic); |
| | | }, () => { |
| | | if (edit) { flMain.RemoveFromParent(); } |
| | | else |
| | | { |
| | | AirSonser(flMain, SelectedDeviceStatus, edit, common); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 空气质量传感器(特殊处理) |
| | | /// </summary> |
| | | /// <param name="flMain"></param> |
| | | /// <param name="SelectedDeviceStatus"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="common"></param> |
| | | /// <param name="dic"></param> |
| | | private static void AddDic(FrameLayout flMain, string SelectedDeviceStatus, bool edit, CommonDevice common, Dictionary<string, string> dic ) |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | if (SelectedDeviceStatus != "") |
| | | { |
| | | //添加条件 |
| | | LogicIfon.AddDeviceconditions(common, dic); |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | var alert = new UserCenter.ShowMsgControl(ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | flMain.RemoveFromParent(); |
| | | //自动化 |
| | | var logicCommunalPage = new LogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | } |
| | | |
| | | } |
| | | } |