Example #1
0
 private void systemInformationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (Client c in GetSelectedClients())
     {
         FrmSystemInformation frmSi = FrmSystemInformation.CreateNewOrGetExisting(c);
         frmSi.Show();
         frmSi.Focus();
     }
 }
        /// <summary>
        /// Creates a new system information form for the client or gets the current open form, if there exists one already.
        /// </summary>
        /// <param name="client">The client used for the system information form.</param>
        /// <returns>
        /// Returns a new system information form for the client if there is none currently open, otherwise creates a new one.
        /// </returns>
        public static FrmSystemInformation CreateNewOrGetExisting(Client client)
        {
            if (OpenedForms.ContainsKey(client))
            {
                return(OpenedForms[client]);
            }
            FrmSystemInformation f = new FrmSystemInformation(client);

            f.Disposed += (sender, args) => OpenedForms.Remove(client);
            OpenedForms.Add(client, f);
            return(f);
        }