void pProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (null != e.Data)
{
Match matchAverageTimeRepeat = rAverageTimeRepeat.Match(e.Data);
if (matchAverageTimeRepeat.Success)
{
UInt32 uiSeqNumber = Convert.ToUInt32(matchAverageTimeRepeat.Groups[1].Value);
Double dAverageTime = Convert.ToDouble(matchAverageTimeRepeat.Groups[2].Value);
sResult = String.Format("Average seq time (over {0} seqs) = {1,-12:f4} mSec.", uiSeqNumber, dAverageTime);
this.demoThread = new Thread(new ThreadStart(this.ThreadProcSafe));
this.demoThread.Start();
}
}
}
private void ThreadProcSafe()
{
SetText(sResult);
}
private void SetText(string text)
{
if (this.listboxTestResults.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.listboxTestResults.Items.Add(text);
listboxTestResults.TopIndex = listboxTestResults.Items.Count - 1;
}
}