private static MessageBoxButton ParseIDialogServiceButtons(IMessageBoxServiceButtons buttons) { switch (buttons) { case IMessageBoxServiceButtons.OK: return(MessageBoxButton.OK); case IMessageBoxServiceButtons.YesNo: return(MessageBoxButton.YesNo); case IMessageBoxServiceButtons.YesNoCancel: return(MessageBoxButton.YesNoCancel); default: return(MessageBoxButton.OK); } }
/// <summary> /// Shows a dialog with the given <paramref name="text"/> as content /// and the given <paramref name="title"/> in the title bar. /// Gives the user the given <paramref name="buttons"/> to press. /// Also displays an icon next to the text. /// </summary> /// <param name="text">Text to display in the dialog.</param> /// <param name="title">Text to display in the title of the dialog.</param> /// <param name="buttons">Buttons displayed in the dialog.</param> /// <param name="icon">Icon to display in the dialog.</param> /// <returns>Result of the dialog</returns> public IMessageBoxServiceResult ShowDialog(string text, string title, IMessageBoxServiceButtons buttons, IMessageBoxServiceIcon icon) { return(ParseMessageBoxResult(MessageBox.Show(text, title, ParseIDialogServiceButtons(buttons), ParseIDialogServiceIcon(icon)))); }