/// <summary> /// Shows the TFS connection string manager. /// </summary> /// <param name="operation">The operation.</param> private void ShowTFSConnectionStringManager(OperationType operation) { try { switch (operation) { case OperationType.Add: using (TFSConnectionEditor editor = new TFSConnectionEditor()) { editor.StartPosition = FormStartPosition.CenterParent; editor.ShowDialog(this); } break; case OperationType.Edit: using (TFSConnectionEditor editor = new TFSConnectionEditor(this.selectedTFSConnectionString, true)) { editor.StartPosition = FormStartPosition.CenterParent; editor.ShowDialog(this); } break; case OperationType.Delete: using (AdvancedMessageBox advBox = new AdvancedMessageBox("Are you sure you want to continue?", ReportStatus.Information, true)) { if (DialogResult.OK == advBox.ShowDialog(this)) { this.selectedTFSConnectionString.DeleteTFSConnectionStringToDB(); } } break; default: break; } string selectedServername = this.selectedTFSConnectionString != null ? this.selectedTFSConnectionString.ServerName : string.Empty; this.tFSConnectionsTableAdapter.Fill(this.deploymentTrackerLocalDBTFSConnectionsDataSet.TFSConnections); this.dgvTFSsettings.Refresh(); if (!string.IsNullOrEmpty(selectedServername)) { foreach (DataGridViewRow item in this.dgvTFSsettings.Rows) { if (item.Cells[0].Value.ToString() == selectedServername) { item.Selected = true; break; } } } } catch (InvalidOperationException invalidOps) { invalidOps.ShowUIException(); } catch (ArgumentException argexception) { argexception.ShowUIException(); } catch (DBConcurrencyException dbexception) { dbexception.ShowUIException(); } catch (Exception e) { e.ShowGenericException(); } finally { this.CheckForNoRows(); } }
/// <summary> /// Shows the UI exception. /// </summary> /// <param name="ex">The ex.</param> public static void ShowUIException(this Exception ex) { ex.WriteToLog(); using (AdvancedMessageBox advBox = new AdvancedMessageBox(ex.Message, ReportStatus.Fail)) { advBox.StartPosition = FormStartPosition.CenterScreen; advBox.TopMost = true; advBox.ShowDialog(); } }
/// <summary> /// Shows the UI information. /// </summary> /// <param name="message">The message.</param> /// <param name="startpos">The startpos.</param> public static void ShowUIInformation(this string message, FormStartPosition startpos = FormStartPosition.CenterParent) { using (AdvancedMessageBox advBox = new AdvancedMessageBox(message, ReportStatus.Information)) { advBox.StartPosition = startpos; advBox.TopMost = true; advBox.ShowDialog(); } }
/// <summary> /// Shows the generic exception. /// </summary> /// <param name="ex">The ex.</param> /// <param name="customMessage">The custom message.</param> public static void ShowGenericException(this Exception ex, string customMessage = "") { ex.WriteToLog(); string msgToshow = string.IsNullOrEmpty(customMessage) ? "Unexpected error occurred." : customMessage; using (AdvancedMessageBox advBox = new AdvancedMessageBox(string.Concat(msgToshow, "\n Please refer Application log for further details."), ReportStatus.Fail)) { advBox.StartPosition = FormStartPosition.CenterScreen; advBox.TopMost = true; advBox.ShowDialog(); } }