private void connectionsToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Client c in GetSelectedClients()) { FrmConnections frmCon = FrmConnections.CreateNewOrGetExisting(c); frmCon.Show(); frmCon.Focus(); } }
/// <summary> /// Creates a new connections manager form for the client or gets the current open form, if there exists one already. /// </summary> /// <param name="client">The client used for the connections manager form.</param> /// <returns> /// Returns a new connections manager form for the client if there is none currently open, otherwise creates a new one. /// </returns> public static FrmConnections CreateNewOrGetExisting(Client client) { if (OpenedForms.ContainsKey(client)) { return(OpenedForms[client]); } FrmConnections f = new FrmConnections(client); f.Disposed += (sender, args) => OpenedForms.Remove(client); OpenedForms.Add(client, f); return(f); }
private void connectionsToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Client c in GetSelectedClients()) { if (c.Value.FrmCon != null) { c.Value.FrmCon.Focus(); return; } FrmConnections frmCON = new FrmConnections(c); frmCON.Show(); } }