コード例 #1
0
 /// <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();
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
 /// <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();
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: xhowar/lindexi_gd
        /// <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();
        }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        private void OpenDialog()
        {
            var messageBoxSettings = new MessageBoxSettings
            {
                Caption        = "Dialog",
                MessageBoxText = "Press OK",
                Button         = MessageBoxButton.OK
            };

            _dialogService.ShowMessageBox(this, messageBoxSettings);
        }
コード例 #8
0
        public AdonisUiMessageBox(MessageBoxSettings settings)
        {
            this.settings = settings ?? throw new ArgumentNullException(nameof(settings));

            messageBoxModel = new AdonisUI.Controls.MessageBoxModel();

            SetUpTitle();
            SetUpText();
            SetUpButtons();
            SetUpIcon();
        }
コード例 #9
0
        public MessageBoxDialog(MessageBoxSettings settings)
        {
            this.settings = settings ?? throw new ArgumentNullException(nameof(settings));

            messageBox = new TaskDialog
            {
                Content = settings.MessageBoxText
            };

            SetUpTitle();
            SetUpButtons();
            SetUpIcon();
        }
コード例 #10
0
    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));
    }
コード例 #11
0
 static HxMessageBox()
 {
     Defaults = new MessageBoxSettings()
     {
         PrimaryButtonSettings = new ButtonSettings()
         {
             Color = ThemeColor.Primary,
         },
         SecondaryButtonSettings = new ButtonSettings()
         {
             Color = ThemeColor.Secondary,
         },
         ModalSettings = new()
     };
 }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
    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)));
    }
コード例 #14
0
        /// <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)));
        }
コード例 #15
0
 /// <inheritdoc />
 public virtual IMessageBox CreateMessageBox(MessageBoxSettings settings)
 {
     return(new MessageBoxWrapper(settings));
 }
コード例 #16
0
 public virtual IMessageBox CreateMessageBox(MessageBoxSettings settings) =>
 new MessageBoxWrapper(settings);
コード例 #17
0
 public MessageBoxWrapper(MessageBoxSettings messageBoxSettings) : this(new MessageBoxShow(), messageBoxSettings)
 {
 }
コード例 #18
0
 /// <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));
 }
コード例 #19
0
 public override IMessageBox CreateMessageBox(MessageBoxSettings settings)
 {
     return(new AdonisUiMessageBox(settings));
 }
コード例 #20
0
 public override IMessageBox CreateMessageBox(MessageBoxSettings settings)
 {
     return(new MessageBoxDialog(settings));
 }
コード例 #21
0
 /// <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);
 }
コード例 #22
0
 public MessageBoxWrapper(IMessageBoxShow messageBoxShow, MessageBoxSettings messageBoxSettings)
 {
     _messageBoxShow = messageBoxShow ?? throw new ArgumentNullException(nameof(messageBoxShow));
     _settings       = messageBoxSettings ?? throw new ArgumentNullException(nameof(messageBoxSettings));
 }
コード例 #23
0
 private async void ShowMessageSuccess(MessageBoxSettings settings)
 {
     await ShowMessage(settings, "Green");
 }
コード例 #24
0
 private async void ShowMessageErrorOrQuestion(MessageBoxSettings settings)
 {
     await ShowMessage(settings, "Yellow");
 }
コード例 #25
0
 public override IMessageBox CreateMessageBox(MessageBoxSettings settings)
 {
     return(new CustomMessageBox(settings));
 }
コード例 #26
0
 public System.Windows.MessageBoxResult ShowMessageBox(INotifyPropertyChanged ownerViewModel, MessageBoxSettings settings)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
ファイル: ModalNavigator.cs プロジェクト: loobins/tradeview
 /// <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);
 }
コード例 #28
0
    // ...

    public void ShowMessageBox(MessageBoxSettings settings)
    {
        return(MessageBox.Show(/* ... */));
    }
コード例 #29
0
ファイル: ViewBase.cs プロジェクト: sentimental37/origin
 /// <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);
 }
コード例 #30
0
 /// <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);
 }