public static void ShowInfo(IWin32Window owner, string text, float timeCloseSecond = 3.5f) { try { Control ctrl = owner as Control; if (ctrl == null) { Form main = Application.OpenForms[0]; foreach (var item in Application.OpenForms) { FrmMain form = item as FrmMain; if (form != null) { main = form; break; } } ctrl = main; } ctrl.Invoke(new Action(() => { FrmInfo frmInfo = new FrmInfo(text, timeCloseSecond); if (ctrl == null) { frmInfo.Show(); } else { frmInfo.Show(ctrl); } frmInfo.Refresh(); })); } catch (Exception ex) { } }
public static void ShowInfoWindow(IWin32Window owner, string text, float timeclose = 3.5f) { FrmInfo.ShowInfo(owner, text, timeclose); }