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();
}
}