/// <summary> /// Overloaded. /// </summary> /// <param name="title">The title of the message box dialog.</param> /// <param name="message">The message to display in the message box.</param> /// <param name="settings">MessageBoxSettings for the dialog.</param> public MessageBoxViewModel(string title, string message, MessageBoxSettings settings) { this.Title = title; this.DialogBody = message; this.settings = settings; SetDialogVisuals(); }
/// <summary> /// Raises the <see cref="ShowMessageWindow"/> event which is handled on the view. /// </summary> /// <param name="messageBoxSettings">Details of the message to display.</param> /// <returns>The message result.</returns> protected MessageBoxResult ShowMessageBox(MessageBoxSettings messageBoxSettings) { var showMessageWindow = ShowMessageWindow; showMessageWindow?.Invoke(this, messageBoxSettings); return(messageBoxSettings.MessageBoxResult); }
/// <summary>Create an instance of the default Windows message box.</summary> /// <param name="settings">The settings for the message box.</param> public IMessageBox CreateMessageBox(MessageBoxSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } return(new MessageBoxWrapper(settings)); }
/// <summary> /// Default constructor. /// </summary> /// <param name="title">The title of the message box dialog.</param> /// <param name="message">The message to display in the message box.</param> public MessageBoxViewModel(string title, string message) { this.Title = title; this.DialogBody = message; if (this.settings == null) { this.settings = new MessageBoxSettings(); } SetDialogVisuals(); }
/// <summary> /// Initializes a new instance of the <see cref="CustomMessageBox"/> class. /// </summary> /// <param name="settings">The settings for the folder browser dialog.</param> public CustomMessageBox(MessageBoxSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); SetUpTitle(); SetUpButtons(); SetUpIcon(); }
/// <summary> /// Raises the <see cref="ShowMessageWindow"/> event which is handled on the view. /// </summary> /// <param name="messageBoxSettings">Details of the message to display.</param> /// <returns>The message result.</returns> protected MessageBoxResult ShowMessageBox(MessageBoxSettings messageBoxSettings) { var showMessageWindow = ShowMessageWindow; if (showMessageWindow != null) { showMessageWindow(this, messageBoxSettings); } return(messageBoxSettings.MessageBoxResult); }
private void OpenDialog() { var messageBoxSettings = new MessageBoxSettings { Caption = "Dialog", MessageBoxText = "Press OK", Button = MessageBoxButton.OK }; _dialogService.ShowMessageBox(this, messageBoxSettings); }
public AdonisUiMessageBox(MessageBoxSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); messageBoxModel = new AdonisUI.Controls.MessageBoxModel(); SetUpTitle(); SetUpText(); SetUpButtons(); SetUpIcon(); }
public MessageBoxDialog(MessageBoxSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); messageBox = new TaskDialog { Content = settings.MessageBoxText }; SetUpTitle(); SetUpButtons(); SetUpIcon(); }
public MessageBoxResult ShowMessageBox(INotifyPropertyChanged ownerViewModel, string message, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None) { var settings = new MessageBoxSettings { Message = message, Caption = caption, Button = button, Icon = icon, DefaultResult = defaultResult }; return(ShowMessageBox(ownerViewModel, settings)); }
static HxMessageBox() { Defaults = new MessageBoxSettings() { PrimaryButtonSettings = new ButtonSettings() { Color = ThemeColor.Primary, }, SecondaryButtonSettings = new ButtonSettings() { Color = ThemeColor.Secondary, }, ModalSettings = new() }; }
private async Task ShowMessage(MessageBoxSettings settings, string sAccent) { settings.Settings.ColorScheme = MetroDialogColorScheme.Accented; var oldTheme = ThemeManager.DetectAppStyle(Application.Current); ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(sAccent), ThemeManager.GetAppTheme("BaseLight")); var result = await this.ShowMessageAsync(settings.Title, settings.Message, settings.Style, settings.Settings); ThemeManager.ChangeAppStyle(Application.Current, oldTheme.Item2, ThemeManager.GetAppTheme("BaseLight")); if (settings.Callback != null) { settings.Callback(result); } }
public MessageBoxResult ShowMessageBox(INotifyPropertyChanged ownerViewModel, MessageBoxSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var messageBox = _frameworkDialogFactory.CreateMessageBox(settings); return(messageBox.Show(FindOwnerWindow(ownerViewModel))); }
/// <summary> /// Displays a message box that has a message, title bar caption, button, and icon; and /// that accepts a default message box result and returns a result. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the message box dialog.</param> /// <returns> /// A <see cref="MessageBoxResult"/> value that specifies which message box button is /// clicked by the user. /// </returns> /// <exception cref="ViewNotRegisteredException"> /// No view is registered with specified owner view model as data context. /// </exception> public MessageBoxResult ShowMessageBox( INotifyPropertyChanged ownerViewModel, MessageBoxSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Logger.Write($"Caption: {settings.Caption}; Message: {settings.MessageBoxText}"); var messageBox = frameworkDialogFactory.CreateMessageBox(settings); return(messageBox.Show(FindOwnerWindow(ownerViewModel))); }
/// <inheritdoc /> public virtual IMessageBox CreateMessageBox(MessageBoxSettings settings) { return(new MessageBoxWrapper(settings)); }
public virtual IMessageBox CreateMessageBox(MessageBoxSettings settings) => new MessageBoxWrapper(settings);
public MessageBoxWrapper(MessageBoxSettings messageBoxSettings) : this(new MessageBoxShow(), messageBoxSettings) { }
/// <summary> /// Initializes a new instance of the <see cref="CustomMessageBox"/> class. /// </summary> /// <param name="settings">The settings for the folder browser dialog.</param> public CustomMessageBox(MessageBoxSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); }
public override IMessageBox CreateMessageBox(MessageBoxSettings settings) { return(new AdonisUiMessageBox(settings)); }
public override IMessageBox CreateMessageBox(MessageBoxSettings settings) { return(new MessageBoxDialog(settings)); }
/// <summary> /// Shows a message box and sets the message box result. /// </summary> /// <param name="messageBoxSettings">The message box settings.</param> public void ShowMessageBox(MessageBoxSettings messageBoxSettings) { Messaging.ShowMessage(messageBoxSettings); }
public MessageBoxWrapper(IMessageBoxShow messageBoxShow, MessageBoxSettings messageBoxSettings) { _messageBoxShow = messageBoxShow ?? throw new ArgumentNullException(nameof(messageBoxShow)); _settings = messageBoxSettings ?? throw new ArgumentNullException(nameof(messageBoxSettings)); }
private async void ShowMessageSuccess(MessageBoxSettings settings) { await ShowMessage(settings, "Green"); }
private async void ShowMessageErrorOrQuestion(MessageBoxSettings settings) { await ShowMessage(settings, "Yellow"); }
public override IMessageBox CreateMessageBox(MessageBoxSettings settings) { return(new CustomMessageBox(settings)); }
public System.Windows.MessageBoxResult ShowMessageBox(INotifyPropertyChanged ownerViewModel, MessageBoxSettings settings) { throw new NotImplementedException(); }
/// <summary> /// Shows a message box and sets the message box result. /// </summary> /// <param name="messageBoxSettings">The message box settings.</param> public static void ShowMessageBox(MessageBoxSettings messageBoxSettings) { Dialog.ShowMessage(messageBoxSettings); }
// ... public void ShowMessageBox(MessageBoxSettings settings) { return(MessageBox.Show(/* ... */)); }
/// <summary> /// Handles the ShowMessageBox event raised by the view model. /// </summary> /// <param name="sender">The view model.</param> /// <param name="e">Message box settings.</param> protected void ShowMessageBox(object sender, MessageBoxSettings e) { ViewContext.ModalNavigator.ShowMessageBox(e); }
/// <summary> /// Handles the ShowMessageBox event raised by the view model. /// </summary> /// <param name="sender">The view model.</param> /// <param name="e">Message box settings.</param> protected static void ShowMessageBox(object sender, MessageBoxSettings e) { ModalNavigator.ShowMessageBox(e); }