private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
bool isLocalDeployment = e.Argument != null && (bool)e.Argument;
this.backgroundWorker.ReportProgress(10, "Initializing deployment tasks....");
// log details into database
string updatedversion = this.buildArgs == null ? (!string.IsNullOrEmpty(this.rollbackVersionToLog) ? this.rollbackVersionToLog : UtilityLibrary.GetUniqueVersionForSolution(this.pkgNameForLocalDeployment)) : this.buildArgs.Version;
this.LogDeploymentDetailsIntoDatabase(true, DeploymentStatus.Deploying, updatedversion, this.cloudArgs.DeploymentSlot);
if (this.PerformBuildOperation(isLocalDeployment, updatedversion))
{
this.backgroundWorker.ReportProgress(20, "Starting cloud deployment task....");
string solutionNameFromPackage = Path.GetFileNameWithoutExtension(this.txtPackagePath.Text);
if (this.PerformCloudDeployment())
{
if (isLocalDeployment)
{
UtilityLibrary.UpdateDeploymentLogStatus(solutionNameFromPackage, this.cloudArgs.InternalVersionNumber, this.cbxIsRollback.Checked ? DeploymentStatus.Rollback : DeploymentStatus.Deployed);
}
else
{
UtilityLibrary.UpdateDeploymentLogStatus(this.buildArgs.SolutionName, this.buildArgs.Version, DeploymentStatus.Deployed);
}
this.Invoke((MethodInvoker)(() => string.Format("Application deployed successfully on cloud.Will be up in a moment.").ShowUIInformation(FormStartPosition.CenterScreen)));
}
else
{
if (isLocalDeployment)
{
UtilityLibrary.UpdateDeploymentLogStatus(solutionNameFromPackage, this.cloudArgs.InternalVersionNumber, DeploymentStatus.Failed);
}
else
{
UtilityLibrary.UpdateDeploymentLogStatus(this.buildArgs.SolutionName, this.buildArgs.Version, DeploymentStatus.Failed);
}
}
}
else
{
UtilityLibrary.UpdateDeploymentLogStatus(this.buildArgs.SolutionName, this.buildArgs.Version, DeploymentStatus.Failed);
this.backgroundWorker.ReportProgress(20, ReportStatus.Fail);
}
}