/// <summary> /// Handles the CellContentClick event of the dgvLogView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Forms.DataGridViewCellEventArgs"/> instance containing the event data.</param> private void dgvLogView_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex == -1 || e.ColumnIndex ==-1 || this.dgvLogView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null) { return; } string status = Convert.ToString(this.dgvLogView.Rows[e.RowIndex].Cells["statusDataGridViewTextBoxColumn"].Value); if (status.Equals(DeploymentStatus.Deploying.ToString())) { "Deployment is going on. Please wait until it complete".ShowUIInformation(); return; } string cmdValue = this.dgvLogView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().ToLower(); string application = Convert.ToString(this.dgvLogView.Rows[e.RowIndex].Cells["applicationDataGridViewTextBoxColumn"].Value); string version = this.dgvLogView.Rows[e.RowIndex].Cells["versionDataGridViewTextBoxColumn"].Value.ToString(); switch (cmdValue) { case "details": Convert.ToString(this.dgvLogView.Rows[e.RowIndex].Cells["DeploymentNotes"].FormattedValue).PopInformationDialog(string.Format("Deployment Notes: {0}v{1}", application, version)); break; case "log": string solutionFolderName = string.Concat(application, "-", version, status.Equals(DeploymentStatus.Rollback.ToString()) || (status.Equals(DeploymentStatus.Failed.ToString()) && UtilityLibrary.IsRollbackVersion(application, version)) ? Constants.RollbackFolderExtension : string.Empty); using (LogViewerStrip logStrip = new LogViewerStrip(solutionFolderName)) { logStrip.StartPosition = FormStartPosition.CenterParent; logStrip.ShowDialog(); } break; case "rollback": // This is for action column only. Status column value is interfering here string headerTextForVersion = this.dgvLogView.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.HeaderText; if (!string.IsNullOrEmpty(headerTextForVersion)) { return; } if (!UtilityLibrary.CanRollback(application)) { string.Format("Please wait until all deployements of {0} are completed.", application).ShowUIInformation(); return; } string lastVersion = UtilityLibrary.GetLastSuccessfulVersionForSolution(application, version); using (PackageDeployment deployScreen = new PackageDeployment(true, lastVersion, version, application) { StartPosition = FormStartPosition.CenterScreen }) { deployScreen.ShowDialog(this); } break; } } catch (DirectoryNotFoundException ex) { // show this is info instead of error ex.Message.ShowUIInformation(); } catch (Exception ex) { ex.ShowGenericException(); } }
/// <summary> /// Handles the Click event of the pictureBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void PictureBox_Click(object sender, EventArgs e) { try { PictureBox picturebox = sender as PictureBox; if (picturebox == null) { return; } switch (picturebox.Name) { case "picboxConfigureDeploymentTool": if (this.deploymentWindows != 0) { throw new InvalidOperationException("Cannot edit settings while deployments are going on. Please try again."); } this.Hide(); using (AppConfigManager configManager = new AppConfigManager()) { configManager.StartPosition = FormStartPosition.CenterParent; configManager.FormClosed += new FormClosedEventHandler(this.FormReopen); configManager.ShowDialog(this); } break; case "picboxDeploy": if (this.deploymentWindows < int.Parse(Settings.Default.MaxSessionsPermitted)) { this.Hide(); PackageDeployment packageDeployment = new PackageDeployment(); packageDeployment.StartPosition = FormStartPosition.CenterParent; packageDeployment.Load += new EventHandler(this.PackageDeployment_Load); packageDeployment.FormClosed += new FormClosedEventHandler(this.PackageDeployment_FormClosed); packageDeployment.Show(); this.deploymentWindows++; } else { MessageBox.Show(string.Format(CultureInfo.CurrentUICulture, "Cannot exceed more than {0} sessions. Please wait until one or more session to complete.", Settings.Default.MaxSessionsPermitted), "Maximum sessions exceeded", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "picboxReports": this.Hide(); using (ReportScreen deployReport = new ReportScreen()) { deployReport.StartPosition = FormStartPosition.CenterParent; deployReport.FormClosed += new FormClosedEventHandler(this.FormReopen); deployReport.ShowDialog(this); } break; case "picboxManageAzureConfigurations": this.Hide(); using (AppLogViewer applogviewer = new AppLogViewer()) { applogviewer.StartPosition = FormStartPosition.CenterParent; applogviewer.FormClosed += new FormClosedEventHandler(this.FormReopen); applogviewer.ShowDialog(this); } break; } } catch (InvalidOperationException invalidOp) { invalidOp.ShowUIException(); } }