private void log_Stoped(object sender, EventArgs e) { if (InvokeRequired) { BeginInvoke((MethodInvoker)(() => { cBtnLogOnOff.Checked = false; cBtnLogOnOff.Text = "Start"; tBoxLogMaxSamples.Enabled = true; btnLogBrowseFile.Enabled = true; log.Stop(); UpdateProgressBarStyle(); }), null); } else { cBtnLogOnOff.Checked = false; cBtnLogOnOff.Text = "Start"; tBoxLogMaxSamples.Enabled = true; btnLogBrowseFile.Enabled = true; log.Stop(); UpdateProgressBarStyle(); } }