protected virtual void OnHeaderRead(object sender, EventArgs e) { delegateSetProgressBarMax dspbm = new delegateSetProgressBarMax(SetProgressBarMax); delegateSetHeaderInfo setHeaderInfo = new delegateSetHeaderInfo(SetHeaderInfo); if (InvokeRequired) { Invoke(dspbm, new object[] { ((HeaderReadEventArgs)e).RowCount }); Invoke(setHeaderInfo, new object[] { Meter.SerialNumber, Meter.SampleCount.ToString() }); }//if else { dspbm(((HeaderReadEventArgs)e).RowCount); setHeaderInfo(Meter.SerialNumber, Meter.SampleCount.ToString()); }//else }