private void cBtnLogOnOff_CheckedChanged(object sender, EventArgs e) { OnError((byte)0, "-"); try { if (cBtnLogOnOff.Checked) { cBtnLogOnOff.Text = "Stop"; tBoxLogMaxSamples.Enabled = false; btnLogBrowseFile.Enabled = false; log.Start(); } else { cBtnLogOnOff.Text = "Start"; tBoxLogMaxSamples.Enabled = true; btnLogBrowseFile.Enabled = true; log.Stop(); } } catch (Exception ex) { cBtnLogOnOff.Checked = false; cBtnLogOnOff.Text = "Start"; tBoxLogMaxSamples.Enabled = true; btnLogBrowseFile.Enabled = true; log.Stop(); OnError((byte)1, ex.Message); } finally { UpdateProgressBarStyle(); } }