| | |
| | | /// </summary> |
| | | /// <param name="thisView">当前界面</param> |
| | | /// <param name="viewLayout">上下滑动控件</param> |
| | | public static void InputCondition(FrameLayout thisView,VerticalScrolViewLayout viewLayout) |
| | | public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | { |
| | | for (int i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | Input inputCondition = Logic.currlogic.input[i]; |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView(); |
| | | viewLayout.AddChidren(inputView.FLayoutView()); |
| | | inputView.FLayoutView(viewLayout); |
| | | ///记录条件类型 |
| | | inputView.btnClick.Name = inputCondition.condition_type; |
| | | ///记录条件索引 |
| | |
| | | inputView.btnText.Text = Language.StringByID(StringId.hour) + ": " + value; |
| | | inputView.btnClick.AddTag("timepoint", value); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "2": |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | case FunctionType.Relay: |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollerCurtain: |
| | | case FunctionType.TrietexCurtain: |
| | | //空调 |
| | | case FunctionType.AC: |
| | | //地热 |
| | | case FunctionType.FloorHeating: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | { |
| | | |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | |
| | | int indexVulae = int.Parse(inputView.btnClick.Tag.ToString()); |
| | | //标记编辑状态 |
| | | bool edit = true; |
| | | //表示是条件 |
| | | string if_type = LogicMethod.condition_if; |
| | | switch (button.Name) |
| | | { |
| | | case "1": |
| | |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae,edit, if_type); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | | |
| | | |
| | | |
| | | } |
| | | }; |
| | | ///删除控件 |
| | | inputView.btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Logic.currlogic.input.Remove(inputCondition); |
| | | inputView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | |
| | | Output outputTarget = Logic.currlogic.output[i]; |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView(); |
| | | viewLayout.AddChidren(targetView.FLayoutView()); |
| | | targetView.FLayoutView(viewLayout); |
| | | ///记录条件类型 |
| | | targetView.btnClick.Name = outputTarget.target_type; |
| | | ///记录条件索引 |
| | |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | | targetView.btnText.Width = Application.GetRealWidth(80); |
| | | //第一个变量显示状态值 |
| | | string stateStr = ""; |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.functionType) |
| | | { |
| | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | { |
| | | bool _if = false; |
| | | foreach (var dic in dicList) |
| | | { |
| | | |
| | | if (dic["key"] == "on_off") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | _if = false; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | _if = true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "brightness") |
| | | { |
| | | string value = dic["value"]; |
| | | if (!_if) |
| | | { |
| | | targetView.btnState.Text += value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.Curtain: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "on": |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | } |
| | | break; |
| | | case "off": |
| | | { |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | break; |
| | | case "stop": |
| | | { |
| | | stateStr = Language.StringByID(StringId.stop); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | } |
| | |
| | | int indexVulae = int.Parse(targetView.btnClick.Tag.ToString()); |
| | | //标记编辑状态 |
| | | bool edit = true; |
| | | //表示是目标 |
| | | string if_type = LogicMethod.target_if; |
| | | switch (button.Name) |
| | | { |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit, if_type); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | |
| | | break; |
| | | } |
| | | }; |
| | | ///删除控件 |
| | | targetView.btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Logic.currlogic.output.Remove(outputTarget); |
| | | targetView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | } |
| | | |