private static void RefreshFormList() { if (Application.OpenForms == null) { return; } foreach (Form form in Application.OpenForms) { try { if (form != null && !form.IsDisposed && !OpenForms.Contains(form)) { form.FormClosing += Form_FormClosing; OpenForms.Add(form); FormOpenedArgs e = new FormOpenedArgs(form); FormOpened?.Invoke(null, e); } } catch (Exception ex) { Logger.HandleError(ex, nameof(FormWrapper)); } } }
private static void FormOpenEventTrigger(Form _form) { try { if (_form != null && _form.IsDisposed == false) { EncompassFormOpenedEventArgs eventArgs = new EncompassFormOpenedEventArgs(_form); FormOpened.Invoke(null, eventArgs); } } catch (Exception) { //handle Exception } }
public static void OpenFrom(Template t, Template from = null) { if (from is null) { t.panel = 1; } else if (from.panel != 3) { t.panel = from.panel + 1; } else if (from.panel == 3) { t.panel = 3; } FormOpened.Invoke(t, new FormEventArgs(from)); }
private static void FormOpenEventTrigger(Form oForm) { try { if (oForm?.IsDisposed == false) { FormOpenedEventArgs eventArgs = new FormOpenedEventArgs(oForm); FormOpened?.Invoke(null, eventArgs); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }