private MessageBoxButtons ToMessageBoxButtons(QuestionDialogButtons buttons) { switch (buttons) { case QuestionDialogButtons.OK: return(MessageBoxButtons.OK); case QuestionDialogButtons.OKCancel: return(MessageBoxButtons.OKCancel); case QuestionDialogButtons.AbortRetryIgnore: return(MessageBoxButtons.AbortRetryIgnore); case QuestionDialogButtons.YesNoCancel: return(MessageBoxButtons.YesNoCancel); case QuestionDialogButtons.YesNo: return(MessageBoxButtons.YesNo); case QuestionDialogButtons.RetryCancel: return(MessageBoxButtons.RetryCancel); default: throw new InvalidOperationException("Unknown QuestionDialogButtons value conversion!"); } }
public DialogAnswer ShowMessageWithQuestion(string text, string caption, QuestionDialogButtons buttons) { return(ToDialogAnswer(MessageBox.Show(text, caption, ToMessageBoxButtons(buttons)))); }
public DialogAnswer ShowMessageWithQuestionCentered(string text, string caption, QuestionDialogButtons buttons, DialogIcon icon) { if (Parent == null) { return(ShowMessageWithQuestion(text, caption, buttons, icon)); } else { return(ToDialogAnswer(MessageBox.Show(Parent, text, caption, ToMessageBoxButton(buttons), ToMessageBoxImage(icon)))); } }