public static KMsgBoxResult Show(string text, string caption, KMsgBoxButton buttons, Icon icon, int timeout) { Misc.EnsureNoInvokeRequired(); // Fail fast. if (!Misc.IsUiStateOK()) return KMsgBoxResult.Cancel; Misc.UiBroker.RequestShowMainForm(); Misc.UiBroker.OnUiEntry(); try { frmKMsgBox msgbox; switch (buttons) { case KMsgBoxButton.OverwriteSkipCancel: { msgbox = new frmKMsgBox( text, caption, icon, new string[] { "Overwrite", "Overwrite All", "Skip", "Skip All", "Cancel" }, timeout); msgbox.ShowDialog(Misc.MainForm); if (msgbox.Retval == -1) return KMsgBoxResult.Cancel; else { switch (msgbox.Retval) { case 0: return KMsgBoxResult.Overwrite; case 1: return KMsgBoxResult.OverwriteAll; case 2: return KMsgBoxResult.Skip; case 3: return KMsgBoxResult.SkipAll; case 4: return KMsgBoxResult.Cancel; default: throw new IndexOutOfRangeException("Unexpected KMsgBox result " + msgbox.Retval); } } } case KMsgBoxButton.OK: { DialogResult res = MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information); if (res == DialogResult.OK) return KMsgBoxResult.OK; return KMsgBoxResult.Cancel; } case KMsgBoxButton.SkipCancel: { msgbox = new frmKMsgBox( text, caption, icon, new string[] { "Skip", "Skip All", "Cancel" }, timeout); msgbox.ShowDialog(Misc.MainForm); if (msgbox.Retval == -1) return KMsgBoxResult.Cancel; else { switch (msgbox.Retval) { case 0: return KMsgBoxResult.Skip; case 1: return KMsgBoxResult.SkipAll; case 2: return KMsgBoxResult.Cancel; default: throw new IndexOutOfRangeException("Unexpected KMsgBox result " + msgbox.Retval); } } } case KMsgBoxButton.OKCancel: { msgbox = new frmKMsgBox( text, caption, icon, new string[] { "OK", "Cancel" }, timeout); msgbox.ShowDialog(Misc.MainForm); if (msgbox.Retval == -1) return KMsgBoxResult.Cancel; else { switch (msgbox.Retval) { case 0: return KMsgBoxResult.OK; case 1: return KMsgBoxResult.Cancel; default: throw new IndexOutOfRangeException("Unexpected KMsgBox result " + msgbox.Retval); } } } case KMsgBoxButton.AcceptCancel: { msgbox = new frmKMsgBox( text, caption, icon, new string[] { "Accept", "Cancel" }, timeout); msgbox.ShowDialog(Misc.MainForm); if (msgbox.Retval == -1) return KMsgBoxResult.Cancel; else { switch (msgbox.Retval) { case 0: return KMsgBoxResult.Accept; case 1: return KMsgBoxResult.Cancel; default: throw new IndexOutOfRangeException("Unexpected KMsgBox result " + msgbox.Retval); } } } default: throw new Exception("Undefined KMsgButton"); } } finally { Misc.UiBroker.OnUiExit(); } }
public static KMsgBoxResult Show(string text, string caption, KMsgBoxButton buttons, MessageBoxIcon icon, int timeout) { return Show(text, caption, buttons, frmKMsgBox.GetIcon(icon), timeout); }
public static KMsgBoxResult Show(string text, string caption, KMsgBoxButton buttons, int timeout) { return Show(text, caption, buttons, Icon.FromHandle(frmKMsgBox.largeIcon[66]), timeout); }
public KMsgBox(string text, string caption, KMsgBoxButton buttons, MessageBoxIcon icon, int timeout) : this(text, caption, buttons, frmKMsgBox.GetIcon(icon), timeout) { }
public KMsgBox(string text, string caption, KMsgBoxButton buttons, int timeout) : this(text, caption, buttons, Icon.FromHandle(frmKMsgBox.largeIcon[66]), timeout) { }
public KMsgBox(string text, string caption, KMsgBoxButton buttons, Icon icon, int timeout) { m_text = text; m_caption = caption; m_buttons = buttons; m_icon = icon; m_timeout = timeout; }