private void BtnDeploy_Click(object sender, EventArgs e)
{
try
{
bool isLocalDeployment = this.tabControl1.SelectedTab.Name.Equals("tabLocalDeployment");
this.Text = this.Text.Contains(this.txtSolutionName.Text) ? this.Text : string.Concat(this.Text, "-[", this.txtSolutionName.Text, "]");
this.progressBar.Maximum = this.progressBar.Step * this.totalStepsIdentified; // number of task
this.btnViewBuildLog.Enabled = this.btnViewDeployLog.Enabled = this.btnViewTFLog.Enabled = false;
if (!isLocalDeployment)
{
this.buildArgs = this.PrepareBuildArgs();
this.buildArgs.Validate();
//replace with new name
this.buildArgs.ModifiedSolutionName = string.Concat(this.buildArgs.SolutionName, "-", this.buildArgs.Version);
}
else
{
if (string.IsNullOrEmpty(this.txtPackagePath.Text) || !File.Exists(this.txtPackagePath.Text))
{
throw new ArgumentException("Invalid package file path", "Package Path");
}
if (string.IsNullOrEmpty(this.txtConfigPath.Text) || !File.Exists(this.txtConfigPath.Text))
{
throw new ArgumentException("Invalid configuration file path", "Config Path");
}
// save this in form variable to avoid STA
this.pkgNameForLocalDeployment = Path.GetFileNameWithoutExtension(this.txtPackagePath.Text);
}
this.cloudArgs = this.PrepareCloudArgs();
// validate the publish setting path and subscriptions combo
if (string.IsNullOrEmpty(this.txtPublishSettingsFilePath.Text) || !File.Exists(this.txtPublishSettingsFilePath.Text))
{
throw new ArgumentException("Invalid publish settings file path", "Publish Settings File");
}
if (this.cbxSubscriptions.SelectedIndex == -1)
{
throw new ArgumentException("Atleast one subscriptions should be selected", "Subscriptions");
}
this.cloudArgs.Validate();
this.ResetTreeViewNodes(this.tvCheckList.Nodes["10"]);
this.ResetTreeViewNodes(this.tvCheckList.Nodes["20"]);
this.progressBar.Value = this.progressBar.Minimum;
if (!this.backgroundWorker.IsBusy)
{
this.SetUserActionOnFrom(false);
this.backgroundWorker.RunWorkerAsync(isLocalDeployment);
}
}
catch (ArgumentNullException argEx)
{
argEx.ShowUIException();
}
catch (ArgumentException argEx)
{
argEx.ShowUIException();
}
}