static bool CheckIfFormIsOpen(string id, string message) { FormCollection fc = Application.OpenForms; foreach (MessageForm frm in fc.OfType <MessageForm>()) { if (frm.frmId == id) { frm._msgText(id, message); return(true); } } return(false); }
private void btUtilizadores_Click(object sender, EventArgs e) { if (!formsOpen.OfType <formPickUser>().Any()) { new formPickUser(dbContainer).Show(this); } else { formsOpen.OfType <formPickUser>().First().Focus(); } }
public static Form Validar <T>(this FormCollection forms) where T : Form { return(forms .OfType <T>() .FirstOrDefault()); }