private static DialogResult Show(ConfirmBox cb) { if (cb.ParentWindow != null) { cb.Left = cb.ParentWindow.Left + (cb.ParentWindow.Width - cb.Width) / 2; cb.Top = cb.ParentWindow.Top + (cb.ParentWindow.Height - cb.Height) / 2; } else { cb.StartPosition = FormStartPosition.CenterScreen; } return(cb.ShowDialog()); }
public static DialogResult Show(Form parent, string title, string message, int intervalInMilliseconds, Decide defaultChoose) { var cb = new ConfirmBox(title, message, intervalInMilliseconds, defaultChoose) { ParentWindow = parent }; if (intervalInMilliseconds == Timeout.Infinite) { cb.PinMessage(); } else { cb.UnpinMessage(); } return(Show(cb)); }