private void buttonDeploy_Click(object sender, EventArgs e) { var history = textHistory.Text.Trim(); buttonDeployClient.Enabled = false; Task.Factory.StartNew(() => { var deploy = new ClientDeploy(); deploy.OnLogReceived += deploy_OnLogReceived; return deploy.Execute(history); }).ContinueWith(_ => { buttonDeployClient.Enabled = true; }, TaskScheduler.FromCurrentSynchronizationContext()); }
private void buttonDeploy_Click(object sender, EventArgs e) { var history = textHistory.Text.Trim(); buttonDeployClient.Enabled = false; Task.Factory.StartNew(() => { var deploy = new ClientDeploy(); deploy.OnLogReceived += deploy_OnLogReceived; return(deploy.Execute(history)); }).ContinueWith(_ => { buttonDeployClient.Enabled = true; }, TaskScheduler.FromCurrentSynchronizationContext()); }