| | |
| | | {//开关灯 |
| | | 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": |
| | |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae,edit); |
| | | deviceFunList.Show(device, indexVulae,edit, if_type); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | |
| | | public static void OutputTarget(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | { |
| | | |
| | | for (int i = 0; i < Logic.currlogic.output.Count; i++) |
| | | { |
| | | Output outputTarget = Logic.currlogic.output[i]; |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView(); |
| | | viewLayout.AddChidren(targetView.FLayoutView()); |
| | | ///记录条件类型 |
| | | targetView.btnClick.Name = outputTarget.target_type; |
| | | ///记录条件索引 |
| | | targetView.btnClick.Tag = i; |
| | | ///条件状态数组 |
| | | List<Dictionary<string, string>> dicList = outputTarget.status as List<Dictionary<string, string>>; |
| | | //显示条件各种类型状态 |
| | | switch (outputTarget.target_type) |
| | | { |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | //用设备的functionType类型找到对应图标; |
| | | targetView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.functionType); |
| | | //显示设备名称 |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | | targetView.btnText.Width = Application.GetRealWidth(80); |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.functionType) |
| | | { |
| | | case FunctionType.Relay: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | { |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | //再次编辑条件状态点击事件 |
| | | targetView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | Button button = (Button)sen; |
| | | //找到当前编辑的索引 |
| | | 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(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit, if_type); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | | |
| | | } |