private void UploadProcess() { string hostName = this.cmbHostName.Text; string pathToUpload = this.txtPathToUpload.Text; string storageAccountName = this.txtStorageAccountName.Text.ToLowerInvariant(); string storageAccountKey = this.txtStorageAccountKey.Text; string containerName = this.ContainerName; bool useDevelopmentStore = this.chkUseDevelopmentStorage.Checked; bool updateHostsFiles = this.chkUpdateHostsFile.Checked; string ipaddress = this.txtIPAddress.Text; this.uploader = new Uploader( hostName, pathToUpload, useDevelopmentStore ? null : storageAccountName, useDevelopmentStore ? null : storageAccountKey, containerName); this.uploader.UploadFile += this.UploadingFile; this.uploader.DeleteBlob += this.DeletingBlob; this.ToProcess(); ICollection<string> blobs = this.uploader.GetCurrentBlobs(); this.blobstodelete = blobs.Count; this.totalsize = this.uploader.GetTotalSizeToUpload(); this.PrepareProgressBar(); if (blobs.Count > 0) { ConfirmProcess confirm = new ConfirmProcess(); DialogResult result = confirm.Process(useDevelopmentStore ? "DevStorage" : storageAccountName, hostName); if (result == DialogResult.Cancel) { this.ToDialog(); return; } if (result == DialogResult.Retry) { this.lblStatus.Text = "Deleting existing blobs"; this.uploader.DeleteCurrentBlobs(); } } this.uploader.Run(); if (this.uploader.Stopped) { MessageBox.Show("Site Upload Stopped", "Upload Process"); } else { if (updateHostsFiles) { HostsUpdater.UpdateDomain(hostName, ipaddress); } this.prgProcess.Value = this.prgProcess.Maximum; this.prgProcess.Refresh(); MessageBox.Show("Site Upload Completed", "Upload Process"); DeployParameters parameters = new DeployParameters() { HostName = hostName, PathToUpload = pathToUpload, UseDevelopmentStorage = useDevelopmentStore, StorageAccountName = storageAccountName, StorageAccountKey = storageAccountKey, UpdateHostsFile = updateHostsFiles, IPAddress = ipaddress }; this.confmanager.SaveDeployParameters(this.configuration, parameters); this.LoadConfiguration(); } this.SetupErrorProvider(); this.ToDialog(); this.uploader = null; }
private void UploadButtonClick(object sender, EventArgs e) { try { this.UploadProcess(); } catch (Exception ex) { this.uploader.Stop(); this.uploader = null; MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ToDialog(); } }