public static MessageBoxResult Show
     (string caption, string text,
     MessageBoxButton button, MessageBoxImage image)
 {
     _messageBox.TxtMsg.Text       = text;
     _messageBox.MessageTitle.Text = caption;
     SetVisibilityOfButtons(button);
     SetImageOfMessageBox(image);
     _messageBox.ShowDialog();
     return(_result);
 }
Esempio n. 2
0
        private static void SetImageOfMessageBox(MessageBoxImage image)
        {
            return;

            switch (image)
            {
            case MessageBoxImage.Warning:
            case MessageBoxImage.Question:
                _messageBox.InnerBorder.BorderBrush = R.Brushes.GoldBrush;
                break;

            case MessageBoxImage.Error:
                _messageBox.InnerBorder.BorderBrush = R.Brushes.HpBrush;
                break;
            }
        }
        private static void SetImageOfMessageBox(MessageBoxImage image)
        {
            switch (image)
            {
            case MessageBoxImage.Warning:
                //_messageBox.SetImage("Warning.png");
                break;

            case MessageBoxImage.Question:
                //_messageBox.SetImage("Question.png");
                break;

            case MessageBoxImage.Information:
                _messageBox.Bg.Background = Application.Current.FindResource("MpBrush") as SolidColorBrush;
                //_messageBox.SetImage("Information.png");
                break;

            case MessageBoxImage.Error:
                //_messageBox.SetImage("Error.png");
                _messageBox.Bg.Background = Application.Current.FindResource("HpBrush") as SolidColorBrush;
                break;
            }
        }
        public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image)
        {
            if (_messageBox == null)
            {
                App.BaseDispatcher.Invoke(Create);
            }

            _messageBox?.Dispatcher.Invoke(() =>
            {
                _messageBox.TxtMsg.Text       = text;
                _messageBox.MessageTitle.Text = caption;
                SetVisibilityOfButtons(button);
                SetImageOfMessageBox(image);
                _messageBox.ShowDialog();
            });
            return(_result);
        }