public void UpdateChannelsInfo(string devID) { _devID = devID; panel1.Controls.Clear(); if (string.IsNullOrEmpty(_devID)) { ShowTips("设备名称为空!"); return; } if (!JFHubCenter.Instance.MDCellNameMgr.ContainTrigCtrlDev(devID)) { ShowTips("设备名称列表中未包含触发控制器设备:" + _devID); return; } string[] trigChnNames = JFHubCenter.Instance.MDCellNameMgr.AllChannelNamesInTrigCtrlDev(devID); if (trigChnNames == null || 0 == trigChnNames.Length) { ShowTips("命名通道数量为0"); return; } IJFDevice_TrigController dev = JFHubCenter.Instance.InitorManager.GetInitor(_devID) as IJFDevice_TrigController; if (dev == null) { ShowTips("设备列表中不存在设备Name = " + _devID); } if (!dev.IsDeviceOpen) { ShowTips("设备当前处于关闭状态"); } int top = 3; for (int i = 0; i < trigChnNames.Count(); i++) { UcTrigCtrlChn ucChn = new UcTrigCtrlChn(); ucChn.Location = new Point(3, top); panel1.Controls.Add(ucChn); ucChn.SetChannelInfo(dev, i, trigChnNames[i]); top = ucChn.Bottom + 5; } }
public void UpdateChannelsInfo(string devID) //必须从名称表中的触发控制器和光源控制器提取信息 { _devID = devID; panelLight.Controls.Clear(); panelTrig.Controls.Clear(); if (string.IsNullOrEmpty(_devID)) { ShowTips("设备名称为空!"); return; } if (!JFHubCenter.Instance.MDCellNameMgr.ContainLightCtrlDev(devID)) { ShowTips("设备名称列表中未包含光源控制器设备:" + _devID); return; } IJFDevice_LightController dev = JFHubCenter.Instance.InitorManager.GetInitor(_devID) as IJFDevice_LightController; if (dev == null) { ShowTips("设备列表中不存在设备Name = " + _devID); //return; } else { if (!dev.IsDeviceOpen) { ShowTips("设备当前处于关闭状态"); } } int top = 3; string[] lightChnNames = JFHubCenter.Instance.MDCellNameMgr.AllChannelNamesInLightCtrlDev(devID); if (lightChnNames == null || 0 == lightChnNames.Length) { ShowTips("开关通道数量为0"); return; } else { top = 3; for (int i = 0; i < lightChnNames.Count(); i++) { UcLightCtrlChn ucChn = new UcLightCtrlChn(); ucChn.Location = new Point(3, top); panelLight.Controls.Add(ucChn); ucChn.SetChannelInfo(dev, i, lightChnNames[i]);//.SetChannelInfo(dev, i, trigChnNames[i]); top = ucChn.Bottom + 5; } } if (dev != null && !typeof(IJFDevice_LightControllerWithTrig).IsAssignableFrom(dev.GetType())) //本设备不支持触发控制器接口 { panelTrig.Visible = false; return; } if (!JFHubCenter.Instance.MDCellNameMgr.ContainTrigCtrlDev(devID)) //不包含触发功能 { ShowTips("设备命名表中不包含触发通道名称信息"); return; } //panelTrig.Top = panelLight.Bottom + 10; panelTrig.Visible = true; string[] trigChnNames = JFHubCenter.Instance.MDCellNameMgr.AllChannelNamesInTrigCtrlDev(devID); if (trigChnNames == null || 0 == trigChnNames.Length) { ShowTips("命名通道数量为0"); return; } top = 3; for (int i = 0; i < trigChnNames.Count(); i++) { UcTrigCtrlChn ucChn = new UcTrigCtrlChn(); ucChn.Location = new Point(3, top); panelTrig.Controls.Add(ucChn); ucChn.SetChannelInfo(dev as IJFDevice_TrigController, i, trigChnNames[i]); top = ucChn.Bottom + 5; } }