private static MessageBoxImage ParseIDialogServiceIcon(IMessageBoxServiceIcon icon) { switch (icon) { case IMessageBoxServiceIcon.None: return(MessageBoxImage.None); case IMessageBoxServiceIcon.Warning: return(MessageBoxImage.Warning); case IMessageBoxServiceIcon.Error: return(MessageBoxImage.Error); default: return(MessageBoxImage.None); } }
/// <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)))); }