| | |
| | | { |
| | | public class InpOrOutLogicMethod |
| | | { |
| | | |
| | | private static InpOrOutLogicMethod s_Current = null; |
| | | |
| | | public static InpOrOutLogicMethod Current |
| | | { |
| | | get |
| | | { |
| | | if (s_Current == null) |
| | | { |
| | | s_Current = new InpOrOutLogicMethod(); |
| | | |
| | | } |
| | | return s_Current; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 输入条件处理方法 |
| | | /// </summary> |
| | | /// <param name="thisView">当前界面</param> |
| | | /// <param name="viewLayout">上下滑动控件</param> |
| | | public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | public void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | { |
| | | for (int i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | |
| | | { |
| | | case "1": |
| | | { |
| | | |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; |
| | | foreach (var dic in dicList) |
| | | { |
| | |
| | | case "2": |
| | | { |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value; |
| | | } |
| | | |
| | | string value= this.GetKeyValue("timesection", dicList); |
| | | inputView.btnText.Text = Language.StringByID(StringId.timeHorizon) + ": " + value; |
| | | } |
| | | break; |
| | | case "3": |
| | | case "9"://可视对讲:9 |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | var device = LogicMethod.Current.GetDevice(inputCondition.sid); |
| | | //用设备的functionType类型找到对应图标; |
| | | inputView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); |
| | | inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device); |
| | | //显示设备名称 |
| | | inputView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | |
| | | case SPK.PanelSocket: |
| | | case SPK.ElectricSocket: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("on_off", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | if (value == "on") |
| | | { |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | inputView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | } |
| | | break; |
| | | //传感器 |
| | | case SPK.SensorHelp: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("alarm_status", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.zhengchang); |
| | | if (value == "alarm") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "alarm") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.qiujiu); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.zhengchang); |
| | | } |
| | | inputView.btnState.Text = Language.StringByID(StringId.qiujiu); |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorSmoke: |
| | | case SPK.SensorGas: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("alarm_status", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuxieluo); |
| | | if (value == "alarm") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "alarm") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.xieluo); |
| | | inputView.btnState.Text = Language.StringByID(StringId.xieluo); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuxieluo); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorWater: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("alarm_status", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuluoshui); |
| | | if (value == "alarm") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "alarm") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.luoshui); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuluoshui); |
| | | } |
| | | inputView.btnState.Text = Language.StringByID(StringId.luoshui); |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorDryContact2: |
| | | { |
| | | foreach (var dic in dicList) |
| | | |
| | | string value = this.GetKeyValue("on_off", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | if (value == "on") |
| | | { |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | inputView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | } |
| | | break; |
| | |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorPir: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("people_status", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuren); |
| | | if (value == "true") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.youren); |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "true") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.youren); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuren); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorDoorWindow: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetKeyValue("contact_status", dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.bihe); |
| | | if (value == "open") |
| | | { |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "open") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.kaiqi); |
| | | |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.bihe); |
| | | } |
| | | inputView.btnState.Text = Language.StringByID(StringId.kaiqi); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.SensorUtrasonic: |
| | | { |
| | | string key = this.GetKey(dicList); |
| | | string value = this.GetValue(dicList); |
| | | string str = ""; |
| | | foreach (var dic in dicList) |
| | | switch (key) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "status": |
| | | case "people_status": |
| | | case "status": |
| | | case "people_status": |
| | | { |
| | | str = Language.StringByID(StringId.wuren); |
| | | if (value == "true") |
| | | { |
| | | if (value == "true") |
| | | { |
| | | str += Language.StringByID(StringId.youren) + ";"; |
| | | } |
| | | else |
| | | { |
| | | str += Language.StringByID(StringId.wuren) + ";"; |
| | | } |
| | | |
| | | |
| | | str = Language.StringByID(StringId.youren); |
| | | } |
| | | break; |
| | | case "dismantle": |
| | | } |
| | | break; |
| | | case "dismantle": |
| | | { |
| | | str = Language.StringByID(StringId.buzaixian); |
| | | if (value == "true") |
| | | { |
| | | if (value == "true") |
| | | { |
| | | str += Language.StringByID(StringId.zaixian); |
| | | } |
| | | else |
| | | { |
| | | str += Language.StringByID(StringId.buzaixian); |
| | | } |
| | | str = Language.StringByID(StringId.zaixian); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | inputView.btnState.Text = str; |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SensorMmvPose: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string key = this.GetKey(dicList); |
| | | string value = this.GetValue(dicList); |
| | | if (key == "people_status") |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuren); |
| | | if (value == "true") |
| | | { |
| | | case "people_status": |
| | | { |
| | | if (value == "true") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "target_status": |
| | | { |
| | | if (value == "4") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | } |
| | | break; |
| | | inputView.btnState.Text = Language.StringByID(StringId.youren); |
| | | } |
| | | |
| | | } |
| | | }break; |
| | | case SPK.SenesorMegahealth2: |
| | | { |
| | | foreach (var dic in dicList) |
| | | else if (key == "target_status") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "fall") |
| | | if (value == "4") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.diedao); |
| | | } |
| | | else |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuren); |
| | | inputView.btnState.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorEnvironment: |
| | | case SPK.SenesorMegahealth2: |
| | | { |
| | | string value = this.GetValue(dicList); |
| | | inputView.btnState.Text = Language.StringByID(StringId.wuren); |
| | | if (value == "fall") { |
| | | inputView.btnState.Text = Language.StringByID(StringId.diedao); |
| | | } |
| | | } |
| | | break; |
| | | case SPK.SensorEnvironment:case SPK.SensorEnvironmentHailin: |
| | | case SPK.SensorEnvironment2: |
| | | case SPK.SensorEnvironment3: |
| | | { |
| | |
| | | case SPK.SensorTemperature: |
| | | { |
| | | |
| | | string str = new InpOrOutLogicMethod { }.GetText(dicList, "temperature"); |
| | | string str =this.GetText(dicList, "temperature"); |
| | | inputView.btnState.Text = str; |
| | | } |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | { |
| | | string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity"); |
| | | string str = this.GetText(dicList, "humidity"); |
| | | inputView.btnState.Text = str; |
| | | |
| | | } |
| | | break; |
| | | case SPK.SensorPm10: |
| | | case SPK.SensorCO2: |
| | | case SPK.SensorPm25: |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorHcho: |
| | | { |
| | | string strvalue = ""; |
| | | foreach (var dic in dicList) |
| | | { |
| | | strvalue = dic["value"]; |
| | | break; |
| | | } |
| | | string str = new PublicInterface().GetSensorLevelText(device, strvalue, true); |
| | | string value = this.GetValue(dicList); |
| | | string str = new PublicInterface().GetSensorLevelText(device, value, true); |
| | | inputView.btnState.Text = str; |
| | | } |
| | | break; |
| | | case SPK.DoorLock: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetValue(dicList); |
| | | if (value == "open") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "open") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.kaiqi); |
| | | } |
| | | |
| | | inputView.btnState.Text = Language.StringByID(StringId.kaiqi); |
| | | } |
| | | } |
| | | break; |
| | | case SPK.doorgate: |
| | | { |
| | | if (inputCondition.identifier == "door_call_cloud_event") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.shipintonghuahujiao); |
| | | } |
| | | else |
| | | { |
| | | string userId = this.GetKeyValue("user_id",dicList); |
| | | var FaceItem = this.GetFaceItem(userId, device.deviceId); |
| | | inputView.btnState.Text = FaceItem.userName; |
| | | } |
| | | } |
| | | break; |
| | | case SPK.IpCam_Imou: |
| | | { |
| | | if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | |
| | | case "8": |
| | | { |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png"; |
| | | foreach (var dic in dicList) |
| | | string value = this.GetValue(dicList); |
| | | if (value == "arrive") |
| | | { |
| | | string strtext = ""; |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "arrive": |
| | | { |
| | | strtext = Language.StringByID(StringId.daoda); |
| | | } |
| | | break; |
| | | case "leave": |
| | | { |
| | | strtext = Language.StringByID(StringId.likai); |
| | | } |
| | | break; |
| | | } |
| | | inputView.btnText.TextID = StringId.likiadaoda; |
| | | inputView.btnState.Text = strtext; |
| | | value = Language.StringByID(StringId.daoda); |
| | | } |
| | | else if (value == "leave") |
| | | { |
| | | value = Language.StringByID(StringId.likai); |
| | | } |
| | | |
| | | inputView.btnText.TextID = StringId.likiadaoda; |
| | | inputView.btnState.Text = value; |
| | | } |
| | | break; |
| | | case "10": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid); |
| | | var scene = LogicMethod.Current.GetSecne(inputCondition.sid); |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; |
| | | inputView.btnNextIcon.Visible = false; |
| | | inputView.btnClick.Visible = false; |
| | |
| | | { |
| | | Button button = (Button)sen; |
| | | //当前编辑的条件 |
| | | Input ckcliInput = inputView.btnClick.Tag as Input; |
| | | Input clickInput = inputView.btnClick.Tag as Input; |
| | | //找到当前编辑的索引 |
| | | int indexVulae = 0; |
| | | for (int index = 0; index < Logic.currlogic.input.Count; index++) |
| | | { |
| | | Input input = Logic.currlogic.input[index]; |
| | | if (input.sid == ckcliInput.sid) |
| | | if (input.sid == clickInput.sid) |
| | | { |
| | | if (button.Name == "3") |
| | | if (button.Name == "3" || button.Name == "9") |
| | | { |
| | | //有些设备比较特殊(例如:海林传感器还是要判断属性值,温湿度属性还要判断比较关系,才能确认是否已经存在该条件,其他设备条件直接用sid判断即可) |
| | | //加一级判断是为兼容特殊设备 |
| | | if (new ConditionDeviceFunList { }.IsContainsAll(ckcliInput.condition, input.condition)) |
| | | if (new ConditionDeviceFunList { }.IsContainsAll(clickInput.condition, input.condition)) |
| | | { |
| | | //用户可能删除数据,使列表索引发生改变; |
| | | //通过唯一sid重新查找到索引且更新索引值 |
| | |
| | | timeTpye.TimeHorizon(fLayout, edit, indexVulae); |
| | | } |
| | | break; |
| | | case "9": |
| | | case "3": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | if (device.spk == SPK.SensorEnvironment |
| | | var device = LogicMethod.Current.GetDevice(inputCondition.sid); |
| | | if (device.spk == SPK.SensorEnvironment || device.spk == SPK.SensorEnvironmentHailin |
| | | || device.spk == SPK.SensorEnvironment2 |
| | | || device.spk == SPK.SensorEnvironment3 |
| | | ) |
| | | { |
| | | //这个设备比较特殊 |
| | | ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); |
| | | ///当前的索引值数据对象 |
| | | Input inputedit = Logic.currlogic.input[indexVulae]; |
| | | ///状态值 |
| | |
| | | { |
| | | titleInt = StringId.wendudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "humidity": |
| | |
| | | { |
| | | titleInt = StringId.shidudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "pm25": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "hcho": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | } |
| | |
| | | else if (device.spk == SPK.SensorTemperature) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae); |
| | | this.SensorView(thisView, device, "temperature", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorHumidity) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae); |
| | | this.SensorView(thisView, device, "humidity", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorCO2) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "co2", indexVulae); |
| | | this.SensorView(thisView, device, "co2", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorPm10) |
| | | { |
| | | |
| | | this.SensorView(thisView, device, "pm10", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorPm25) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "pm25", indexVulae); |
| | | this.SensorView(thisView, device, "pm25", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorTVOC) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "tvoc", indexVulae); |
| | | this.SensorView(thisView, device, "tvoc", indexVulae); |
| | | |
| | | } |
| | | else if (device.spk == SPK.SensorHcho) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "hcho", indexVulae); |
| | | this.SensorView(thisView, device, "hcho", indexVulae); |
| | | |
| | | } |
| | | else |
| | |
| | | /// </summary> |
| | | /// <param name="thisView">当前界面</param> |
| | | /// <param name="viewLayout">上下滑动控件</param> |
| | | public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | public void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | { |
| | | |
| | | for (int i = 0; i < Logic.currlogic.output.Count; i++) |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.Current.GetDevice(outputTarget.sid); |
| | | //用设备的functionType类型找到对应图标; |
| | | targetView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(device.spk); |
| | | targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device); |
| | | //显示设备名称 |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | | |
| | | //插座(有USB) |
| | | case SPK.PanelSocket: |
| | | { |
| | | string on_off = GetKeyValue("on_off_master", dicList); |
| | | if (on_off == "on") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | stateStr = stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | break; |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | //插座 |
| | | case SPK.PanelSocket: |
| | | case SPK.ElectricSocket: |
| | | //机械手 |
| | | case SPK.MechanicalArm: |
| | | {//开关 |
| | | |
| | | foreach (var dic in dicList) |
| | |
| | | { |
| | | stateStr = brightness + "%"; |
| | | } |
| | | if (device.spk == SPK.LightCCT) |
| | | { |
| | | //色温这个属性才有效 |
| | | if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "") |
| | | { |
| | | stateStr += "," +GetKeyValue("cct", dicList) + "k"; |
| | | } |
| | | } |
| | | |
| | | } |
| | | break; |
| | |
| | | case SPK.CurtainRoller: |
| | | { |
| | | string on_off = GetKeyValue("on_off", dicList); |
| | | string percent = GetKeyValue("percent", dicList); |
| | | string percent = GetKeyValue("percent", dicList); |
| | | if (on_off == "on" && percent != "") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic) + percent + "%"; |
| | |
| | | if (percent != "" && angle != "") |
| | | { |
| | | stateStr += Language.StringByID(StringId.onLogic) + percent + "%;"; |
| | | stateStr +=Language.StringByID(StringId.Angle)+angle + "°"; |
| | | stateStr += Language.StringByID(StringId.Angle) + angle + "°"; |
| | | } |
| | | else if (percent != "") |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | | { |
| | | string on_off = GetKeyValue("on_off", dicList); |
| | | string set_temp = GetKeyValue("set_temp", dicList); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | string song_name = GetKeyValue("song_name", dicList); |
| | | string volume = GetKeyValue("volume", dicList); |
| | | stateStr = song_name + ";" +Language.StringByID(StringId.volumeMusic)+volume; |
| | | if (stateStr.StartsWith(";")) |
| | | { |
| | | stateStr = stateStr.Substring(1, stateStr.Length - 1); |
| | | }else if (stateStr.EndsWith(Language.StringByID(StringId.volumeMusic))) |
| | | { |
| | | stateStr = stateStr.Substring(0, stateStr.Length - 3); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case "2": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); |
| | | var scene = LogicMethod.Current.GetSecne(outputTarget.sid); |
| | | targetView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; |
| | | targetView.btnNextIcon.Visible = false; |
| | | //显示场景名称 |
| | |
| | | case "3": |
| | | { |
| | | //用sid找到安防; |
| | | var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid); |
| | | var security = LogicMethod.Current.GetSecurity(outputTarget.sid); |
| | | targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png"; |
| | | targetView.btnDelay.Visible = false; |
| | | //显示安防名称 |
| | |
| | | |
| | | if (outputTarget.target_type == "1" || outputTarget.target_type == "3") |
| | | { |
| | | targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | //再次编辑条件状态点击事件 |
| | | targetView.btnClick.MouseUpEventHandler += (sen, e) => |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.Current.GetDevice(outputTarget.sid); |
| | | TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | |
| | | //延时点击事件 |
| | | targetView.btnDelay.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | |
| | | InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod(); |
| | | inpOrOutLogicMethod.Delayed(thisView, outputTarget.delay, (value) => |
| | | { |
| | | outputTarget.delay = value.ToString(); |
| | | if (outputTarget.target_type == "1") |
| | | { |
| | | targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | }); |
| | | this.Delayed(thisView, outputTarget.delay, (value) => |
| | | { |
| | | outputTarget.delay = value.ToString(); |
| | | if (outputTarget.target_type == "1") |
| | | { |
| | | targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnText.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | | }); |
| | | |
| | | }; |
| | | ///删除控件 |
| | |
| | | /// <param name="button1">显示Btn</param> |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | public static void EditState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4) |
| | | /// <param name="button4">显示Btn</param> |
| | | public void EditDeviceState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4) |
| | | { |
| | | switch (device.spk) |
| | | { |
| | | //插座 |
| | | //插座(有USB) |
| | | case SPK.PanelSocket: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | //开关灯光 |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | //机械手 |
| | | case SPK.MechanicalArm: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | |
| | | break; |
| | | } |
| | | button2.Text = value + "%"; |
| | | } |
| | | break; |
| | | case "cct": |
| | | { |
| | | if (button3 == null) |
| | | { |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button3.Text = value + "k"; |
| | | } |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainDream: |
| | |
| | | |
| | | } |
| | | break; |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | | { |
| | | |
| | | foreach (var dic in dicList) |
| | |
| | | { |
| | | if (value == "true") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.zaixian); |
| | | button2.Text = Language.StringByID(StringId.zaixian); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.buzaixian); |
| | | button2.Text = Language.StringByID(StringId.buzaixian); |
| | | } |
| | | } |
| | | break; |
| | |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth: |
| | | case SPK.SensorMmvPose: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "people_status": |
| | | { |
| | | if (value == "true") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | |
| | | case "target_status": |
| | | { |
| | | if (value == "4") |
| | | { |
| | | button2.Text = Language.StringByID(StringId.shi); |
| | | button1.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | } |
| | | break; |
| | | case "people_status": |
| | | { |
| | | if (value == "true") |
| | | { |
| | | button2.Text = Language.StringByID(StringId.youren); |
| | | } |
| | | else |
| | | { |
| | | button2.Text = Language.StringByID(StringId.wuren); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | |
| | | { |
| | | button1.Text = Language.StringByID(StringId.shi); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "song_name") |
| | | { |
| | | button1.Text = dic["value"]?.ToString(); |
| | | } |
| | | else if (dic["key"] == "volume") |
| | | { |
| | | button2.Text = dic["value"]?.ToString(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.doorgate: |
| | | { |
| | | string value = this.GetKeyValue("user_id", dicList); |
| | | button2.Text = this.GetFaceItem(value, device.deviceId).userName; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="dicList"></param> |
| | | /// <returns></returns> |
| | | public static string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList) |
| | | public string GetKeyValue(string keyValue, List<Dictionary<string, string>> dicList) |
| | | { |
| | | |
| | | string valueStr = ""; |
| | |
| | | return valueStr; |
| | | } |
| | | /// <summary> |
| | | /// 获取Key值 |
| | | /// </summary> |
| | | /// <param name="dicList">注意:永远默认第一个元素</param> |
| | | /// <returns></returns> |
| | | public string GetKey(List<Dictionary<string, string>> dicList) |
| | | { |
| | | if (dicList.Count == 0) |
| | | { |
| | | return ""; |
| | | } |
| | | return dicList[0]["key"].ToString(); |
| | | } |
| | | /// <summary> |
| | | /// 获取value值 |
| | | /// </summary> |
| | | /// <param name="dicList">注意:永远默认第一个元素</param> |
| | | /// <returns></returns> |
| | | public string GetValue(List<Dictionary<string, string>> dicList) |
| | | { |
| | | if (dicList.Count == 0) |
| | | { |
| | | return ""; |
| | | } |
| | | return dicList[0]["value"].ToString(); |
| | | } |
| | | /// <summary> |
| | | ///获取自动化名称 |
| | | /// </summary> |
| | | /// <returns> 新建自动化命名规则</returns> |
| | | public static string GetLogicName(Logic logic) |
| | | public string GetLogicName(Logic logic) |
| | | { |
| | | |
| | | string name = ""; |
| | |
| | | } |
| | | break; |
| | | case "3": |
| | | case "9": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(inputCondition.sid); |
| | | var device = LogicMethod.Current.GetDevice(inputCondition.sid); |
| | | name = device.name + "-"; |
| | | } |
| | | break; |
| | | case "10": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid); |
| | | var scene = LogicMethod.Current.GetSecne(inputCondition.sid); |
| | | name = scene.name + "-"; |
| | | } |
| | | break; |
| | |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.CurrLogicMethod.GetDevice(outputTarget.sid); |
| | | var device = LogicMethod.Current.GetDevice(outputTarget.sid); |
| | | //显示设备名称 |
| | | name += device.name; |
| | | string stateStr = ""; |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.spk) |
| | | { |
| | | case SPK.MechanicalArm: |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | {//开关灯 |
| | | |
| | | foreach (var dic in dicList) |
| | | string value = this.GetValue(dicList); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | if (value == "on") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | case SPK.LightCCT: |
| | | case SPK.LightDimming: |
| | | { |
| | | string on_off = InpOrOutLogicMethod.GetKeyValue("on_off", dicList); |
| | | string brightness = InpOrOutLogicMethod.GetKeyValue("brightness", dicList); |
| | | string on_off = this.GetKeyValue("on_off", dicList); |
| | | string brightness = this.GetKeyValue("brightness", dicList); |
| | | if (on_off == "on" && brightness != "") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic) + brightness + "%"; |
| | |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | | { |
| | | foreach (var dic in dicList) |
| | | string value = this.GetValue(dicList); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | if (value == "on") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else if (value == "off") |
| | | { |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | case "2": |
| | | { |
| | | //用sid找到场景; |
| | | var scene = LogicMethod.CurrLogicMethod.GetSecne(outputTarget.sid); |
| | | var scene = LogicMethod.Current.GetSecne(outputTarget.sid); |
| | | name += scene.name; |
| | | |
| | | } |
| | |
| | | case "3": |
| | | { |
| | | //用sid找到安防; |
| | | var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid); |
| | | var security = LogicMethod.Current.GetSecurity(outputTarget.sid); |
| | | name += security.name; |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | private string GetTimeText(string strTimeValue) |
| | | { |
| | | var timeValue = int.Parse(strTimeValue); |
| | | //因为调试软件上传为空过; |
| | | string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue; |
| | | var timeValue = int.Parse(intTimeValue); |
| | | string state = ""; |
| | | var minutes = timeValue / 60; |
| | | var seconds = timeValue % 60; |
| | |
| | | /// </summary> |
| | | /// <param name="dicList">状态数据列表</param> |
| | | /// <returns></returns> |
| | | private string GetText(List<Dictionary<string, string>> dicList,string key) |
| | | private string GetText(List<Dictionary<string, string>> dicList, string key) |
| | | { |
| | | string strtext = ""; |
| | | foreach (var dic in dicList) |
| | |
| | | strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value); |
| | | } |
| | | break; |
| | | case "pm10": |
| | | { |
| | | strtext = Language.StringByID(StringId.pm10) + new PublicInterface { }.GetString("pm25", value); |
| | | } |
| | | break; |
| | | case "pm25": |
| | | { |
| | | strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value); |
| | |
| | | } |
| | | return strtext; |
| | | } |
| | | private void SensorView(FrameLayout thisView, Function device,string key, int indexVulae) { |
| | | private void SensorView(FrameLayout thisView, Function device, string key, int indexVulae) |
| | | { |
| | | //这个设备比较特殊 |
| | | ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); |
| | | ///当前的索引值数据对象 |
| | | Input inputedit = Logic.currlogic.input[indexVulae]; |
| | | ///状态值 |
| | | string stateValue = ""; |
| | | foreach (var dic in inputedit.condition) |
| | | for (int i=0;i<inputedit.condition.Count;i++) |
| | | { |
| | | var dic = inputedit.condition[i]; |
| | | string comparator = dic["comparator"]; |
| | | stateValue = dic["value"]; |
| | | switch (key) |
| | |
| | | { |
| | | titleInt = StringId.wendudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "humidity": |
| | |
| | | { |
| | | titleInt = StringId.shidudiyu; |
| | | } |
| | | conditionDeviceFunList.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.InputBoxAction(device, titleInt, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "co2": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "pm10": |
| | | { |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm10", StringId.pm10, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "pm25": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "tvoc": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "tvoc", StringId.tvoc, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | case "hcho": |
| | | { |
| | | conditionDeviceFunList.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); |
| | | ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "hcho", StringId.Formaldehyde, indexVulae, true, stateValue); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 查找指定userId |
| | | /// </summary> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | public Face GetFaceItem(string userId, string deviceId) |
| | | { |
| | | if (Send.Current.faceList.Count == 0) |
| | | { |
| | | Send.Current.GetListHomeFace(deviceId, false); |
| | | } |
| | | var face = Send.Current.faceList.Find((o) => { return o.userId == userId; }); |
| | | if (face == null) |
| | | { |
| | | face = new Face(); |
| | | } |
| | | return face; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |