private async void checkBoxLogging_CheckedChanged(object sender, EventArgs e) { logging = checkBoxLogging.Checked; if (checkBoxLogging.Checked) { if (startLog != null) { startLog(); } } else { if (stopLog != null) { await stopLog(); } } }