| | |
| | | { |
| | | 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++) |
| | | { |
| | |
| | | } |
| | | 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.GetIconPath(device.spk); |
| | | //显示设备名称 |
| | | inputView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | |
| | | } |
| | | |
| | | } |
| | | }break; |
| | | } |
| | | break; |
| | | case SPK.SenesorMegahealth2: |
| | | { |
| | | foreach (var dic in dicList) |
| | |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | { |
| | | string str = new InpOrOutLogicMethod { }.GetText(dicList, "humidity"); |
| | | string str = this.GetText(dicList, "humidity"); |
| | | inputView.btnState.Text = str; |
| | | |
| | | } |
| | |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorHcho: |
| | | { |
| | | string strvalue = ""; |
| | | string strvalue = ""; |
| | | foreach (var dic in dicList) |
| | | { |
| | | strvalue = dic["value"]; |
| | |
| | | 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 |
| | | { |
| | | |
| | | foreach (var dic in dicList) |
| | | { |
| | | string key = dic["key"]; |
| | | if (key == "user_id") |
| | | { |
| | | string userId = dic["value"]; |
| | | var FaceItem = this.FaceItem(userId, device.deviceId); |
| | | inputView.btnState.Text = FaceItem.userName; |
| | | // Language.StringByID(StringId.kaiqi); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | 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); |
| | | var device = LogicMethod.Current.GetDevice(inputCondition.sid); |
| | | if (device.spk == SPK.SensorEnvironment |
| | | || device.spk == SPK.SensorEnvironment2 |
| | | || device.spk == SPK.SensorEnvironment3 |
| | |
| | | /// </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.GetIconPath(device.spk); |
| | | //显示设备名称 |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | |
| | | 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: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "song_name") |
| | | { |
| | | stateStr = dic["value"]?.ToString(); |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | //显示安防名称 |
| | |
| | | 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); |
| | |
| | | /// <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) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainDream: |
| | |
| | | |
| | | } |
| | | break; |
| | | case SPK.FloorHeatStandard:case SPK.HvacFloorHeat: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | | { |
| | | |
| | | foreach (var dic in dicList) |
| | |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | |
| | | |
| | | case "target_status": |
| | | { |
| | | if (value == "4") |
| | |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.doorgate: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "user_id") |
| | | { |
| | | button2.Text = dic["value"]?.ToString(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | |
| | | /// <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 = ""; |
| | |
| | | ///获取自动化名称 |
| | | /// </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 = ""; |
| | |
| | | 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) |
| | | { |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | /// </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) |
| | |
| | | } |
| | | 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(); |
| | | ///当前的索引值数据对象 |
| | |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 查找指定userId |
| | | /// </summary> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | public Face FaceItem(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; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |