/// <summary> /// Callback function for the delete instance button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteInstanceOverview_Click(object sender, EventArgs e) { //disclaimer if (MessageBox.Show("Removing a connection will delete any rules and alerts on it, are you sure you want to continue?", "Warning", MessageBoxButtons.YesNo).Equals(DialogResult.No)) { return; } int index = ConnectionDataGrid.CurrentRow.Index; try { ServerControl sc = (ServerControl)MainTabControl.TabPages[index + 1]; // checks to see if a listbox item is selected //remove server control from tab list and list box and its server manager from the PM ConnectionDataGrid.Rows.RemoveAt(index); MainTabControl.TabPages.RemoveAt(index + 1); pm.RemoveServer(sc.serverMan); } catch { MessageBox.Show("Please select an instance to delete.", "Delete Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Installs an existing Servermanager into the UI /// </summary> /// <param name="sm">The ServerManager to install</param> public void InstallExistingServer(ServerManager sm) { ServerControl newTab = new ServerControl(sm); //add tab and list box items ConnectionDataGrid.Rows.Add(GetServerRow(sm)); MainTabControl.TabPages.Add(newTab); }
/// <summary> /// Installs a new server into the program with the given connection string /// </summary> /// <param name="connectionString">The connection string to connect to server with</param> public void InstallNewServer(string connectionString) { ServerManager sm = new ServerManager(connectionString); ServerControl newTab = new ServerControl(sm); pm.AddServer(newTab.serverMan); newTab.serverMan.Connect(); //Add the new tab and connect to the server ConnectionDataGrid.Rows.Add(GetServerRow(sm)); MainTabControl.TabPages.Add(newTab); }
/// <summary> /// Callback function for Edit Instance button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditInstanceOverview_Click(object sender, EventArgs e) { int index = ConnectionDataGrid.CurrentRow.Index; if (index < 0) { MessageBox.Show("Please select an instance to edit.", "Edit Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //Grab server control from tab list and pass it to new form to manipulate ServerControl sc = (ServerControl)MainTabControl.TabPages[index + 1]; EditInstanceForm editInstancePopup = new EditInstanceForm(sc); editInstancePopup.ShowDialog(); //Reflect changes to the ServerControl in the list box //ConnectionDataGrid.Rows.RemoveAt(index); //ConnectionDataGrid.Rows.Insert(index, GetServerRow(sc.serverMan)); ConnectionDataGrid.Rows[index].SetValues(GetServerRow(sc.serverMan)); } }
public EditInstanceForm(ServerControl control) { sc = control; InitializeComponent(); EditInstanceTextBox.Text = control.serverMan.ASMan.ConnectionString; }
/// <summary> /// Installs a new server into the program with the given connection string /// </summary> /// <param name="connectionString">The connection string to connect to server with</param> public void InstallNewServer(string connectionString) { ServerManager sm = new ServerManager(connectionString); ServerControl newTab = new ServerControl(sm); pm.AddServer(newTab.serverMan); newTab.serverMan.Connect(); //Add the new tab and connect to the server ConnectionDataGrid.Rows.Add(GetServerRow(sm)); MainTabControl.TabPages.Add(newTab); }
/// <summary> /// Installs an existing Servermanager into the UI /// </summary> /// <param name="sm">The ServerManager to install</param> public void InstallExistingServer(ServerManager sm) { ServerControl newTab = new ServerControl(sm); //add tab and list box items ConnectionDataGrid.Rows.Add(GetServerRow(sm)); MainTabControl.TabPages.Add(newTab); }
public EditInstanceForm(ServerControl control) { sc = control; InitializeComponent(); EditInstanceTextBox.Text = control.serverMan.ASMan.ConnectionString; }