public void UpdateChannelsInfo(string devID, int moduleIndex) { lstTbTrigIDs.Clear(); pnTrigs.Controls.Clear(); JFDevCellNameManeger mgr = JFHubCenter.Instance.MDCellNameMgr; IJFModule_CmprTrigger md = null; IJFDevice_MotionDaq dev = JFHubCenter.Instance.InitorManager.GetInitor(devID) as IJFDevice_MotionDaq; if (dev != null && dev.CompareTriggerCount > moduleIndex) { md = dev.GetCompareTrigger(moduleIndex); } int trigChannCount = mgr.GetCmpTrigCount(devID, moduleIndex); for (int i = 0; i < trigChannCount; i++) { Label lb = new Label(); lb.Location = new Point(2, 2 + 5 + 33 * i); lb.Text = "序号:" + i.ToString("D2") + "名称:"; pnTrigs.Controls.Add(lb); TextBox tbID = new TextBox(); tbID.Location = new Point(lb.Right, 2 + 33 * i); tbID.Text = mgr.GetCmpTrigName(devID, moduleIndex, i); tbID.BackColor = SystemColors.Control; tbID.ReadOnly = true; tbID.Width = 200; pnTrigs.Controls.Add(tbID); lstTbTrigIDs.Add(tbID); UcCmprTrgChn ucTrig = new UcCmprTrgChn(); ucTrig.Location = new Point(tbID.Right, 2 + 33 * i); ucTrig.SetModuleChn(md, i, "", null); pnTrigs.Controls.Add(ucTrig); } }
/// <summary> /// 更新界面 /// </summary> void AdjustView() { Controls.Clear(); _lstCmpTrigInfos.Clear(); _lstCmpTrigUcs.Clear(); if (null == _trigNames || 0 == _trigNames.Length) { return; } Point loc = new Point(5, 5); for (int i = 0; i < _trigNames.Length; i++) { Label lbInfo = new Label(); lbInfo.AutoSize = true; lbInfo.Text = _trigNames[i]; string errInfo; JFDevCellInfo ci = CheckTrigDevInfo(_trigNames[i], out errInfo); if (null == ci) { lbInfo.Text += " ,ErrorInfo:" + errInfo; } lbInfo.Location = loc; //lbInfo.Top = bottom; loc.Y = lbInfo.Bottom; //bottom = lbInfo.Bottom +5; Controls.Add(lbInfo); _lstCmpTrigInfos.Add(lbInfo); UcCmprTrgChn ucTrig = new UcCmprTrgChn(); if (null == ci) { ci = JFHubCenter.Instance.MDCellNameMgr.GetCmpTrigCellInfo(_trigNames[i]); //尝试使用命名表中的名称 if (ci == null) { ucTrig.SetModuleChn(null, 0, _trigNames[i] + ":无效通道名", null); } else { ucTrig.SetModuleChn(null, ci.ChannelIndex, _trigNames[i], null); } } else { IJFModule_CmprTrigger md = (JFHubCenter.Instance.InitorManager.GetInitor(ci.DeviceID) as IJFDevice_MotionDaq).GetCompareTrigger(ci.ModuleIndex); ucTrig.SetModuleChn(md, ci.ChannelIndex, _trigNames[i], null); } ucTrig.Location = loc; ucTrig.BackColor = SystemColors.ActiveBorder; Controls.Add(ucTrig); _lstCmpTrigUcs.Add(ucTrig); loc.Y = ucTrig.Bottom + 20;//bottom = ucTrig.Bottom + 10; } }