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