private async void BtnCheck_Click(object sender, EventArgs e) { try { this.SetCheckFileButtonStatus(false); StartNewTask(); CheckFileParameter param = GetCheckFileParameter(); CheckFile checkhreading = new CheckFile(this.log, this.tokenSource, param); task = checkhreading.Run(); await task; // } catch (Exception ex) { log.RecordError(ex.Message); //this.SetFolderButtonStatus(true); } finally { this.SetCheckFileButtonStatus(true); } }