private void audioToolstripMenuItem4_Click(object sender, EventArgs e) { foreach (Client c in GetSelectedClients()) { FrmAudio frmKl = FrmAudio.CreateNewOrGetExisting(c); frmKl.Show(); frmKl.Focus(); } }
/// <summary> /// Creates a new remote audio form for the client or gets the current open form, if there exists one already. /// </summary> /// <param name="client">The client used for the remote audio form.</param> /// <returns> /// Returns a new remote audio form for the client if there is none currently open, otherwise creates a new one. /// </returns> public static FrmAudio CreateNewOrGetExisting(Client client) { if (OpenedForms.ContainsKey(client)) { return(OpenedForms[client]); } FrmAudio r = new FrmAudio(client); r.Disposed += (sender, args) => OpenedForms.Remove(client); OpenedForms.Add(client, r); return(r); }