/// <summary>更新所有状态</summary> public void UpdateModuleStatus() { if (InvokeRequired) { Invoke(new Action(UpdateModuleStatus)); return; } if (null == _module) { return; } for (int i = 0; i < _module.EncoderChannels; i++) { UcCmprTrgChn ucEnc = gbChns.Controls[i] as UcCmprTrgChn; ucEnc.UpdateChnStatus(); } int err = 0; for (int i = 0; i < _module.TrigChannels; i++) { int count = 0; err = _module.GetTriggedCount(i, out count); if (0 != err) { lstTrigTimeTbs[i].Text = "Err"; } else { lstTrigTimeTbs[i].Text = count.ToString(); } } }
/// <summary> /// /// </summary> public void AdjustView() { if (InvokeRequired) { Invoke(new Action(AdjustView)); return; } if (null == _module) { lbID.Text = "空对象"; tbEnc.Text = ""; tbTrigCount.Text = ""; btResetCnt.Enabled = false; cbMode.Text = "";//cbMode.SelectedIndex = 0; cbMode.Enabled = false; btSoftTrig.Enabled = false; btCfg.Enabled = false; btSync.Enabled = false; return; } lbID.Text = _id; double dVal = 0; int err = _module.GetEncoderCurrPos(_encChn, out dVal); if (err != 0) { tbEnc.Text = "Err:" + _module.GetErrorInfo(err); } else { tbEnc.Text = dVal.ToString(); } int nVal = 0; int[] trigChns = null; err = _module.GetEncoderTrigBind(_encChn, out trigChns);//一个编码器输入可能会绑定多个触发输出 if (err != 0) { tbTrigCount.Text = "Err:" + _module.GetErrorInfo(err); } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < trigChns.Length; i++) { int trigChn = trigChns[i]; err = _module.GetTriggedCount(trigChn, out nVal); if (err != 0) { sb.Append("Err"); } else { sb.Append(nVal.ToString()); } if (i < trigChns.Length - 1) { sb.Append("|"); } } tbTrigCount.Text = sb.ToString(); } btSync.Enabled = true; btResetCnt.Enabled = true; cbMode.Enabled = true; JFCompareTrigMode trigMode = JFCompareTrigMode.disable; err = _module.GetTrigMode(_encChn, out trigMode); if (err != 0) { cbMode.Text = "Err"; } else { cbMode.SelectedIndex = (int)trigMode; } btSoftTrig.Enabled = true; btCfg.Enabled = true; }