Esempio n. 1
0
 System.Windows.MessageBoxResult IMessageBoxService.Show(
     string messageBoxText, string caption,
     System.Windows.MessageBoxButton button,
     System.Windows.MessageBoxImage icon,
     System.Windows.MessageBoxResult defaultResult)
 {
     return(Convert(XtraMessageBox.Show(messageBoxText, caption, Convert(button), Convert(icon), Convert(defaultResult, button))));
 }
        public static System.Windows.MessageBoxResult Show(string caption, string text)
        {
            System.Windows.MessageBoxButton oButton = System.Windows.MessageBoxButton.OK;

            System.Windows.MessageBoxImage oImage = System.Windows.MessageBoxImage.Error;

            System.Windows.MessageBoxResult oResult = System.Windows.MessageBoxResult.OK;

            switch (caption)
            {
            case Infrastructure.MessageBox.Caption.Error:
            {
                oButton = System.Windows.MessageBoxButton.OK;
                oImage  = System.Windows.MessageBoxImage.Error;
                oResult = System.Windows.MessageBoxResult.OK;
                break;
            }

            case Infrastructure.MessageBox.Caption.Information:
            {
                oButton = System.Windows.MessageBoxButton.OK;
                oImage  = System.Windows.MessageBoxImage.Information;
                oResult = System.Windows.MessageBoxResult.OK;
                break;
            }

            case Infrastructure.MessageBox.Caption.Question:
            {
                oButton = System.Windows.MessageBoxButton.YesNo;
                oImage  = System.Windows.MessageBoxImage.Question;
                oResult = System.Windows.MessageBoxResult.No;
                break;
            }

            case Infrastructure.MessageBox.Caption.Warning:
            {
                oButton = System.Windows.MessageBoxButton.YesNoCancel;
                oImage  = System.Windows.MessageBoxImage.Warning;
                oResult = System.Windows.MessageBoxResult.Cancel;
                break;
            }

            default:
                break;
            }

            return(DevExpress.Xpf.Core.DXMessageBox.Show
                   (
                       caption: caption,
                       messageBoxText: text,
                       button: oButton,
                       icon: oImage,
                       defaultResult: oResult,
                       options: System.Windows.MessageBoxOptions.RightAlign | System.Windows.MessageBoxOptions.RtlReading
                   ));
        }
Esempio n. 3
0
        protected override void Execute(CodeActivityContext context)
        {
            string caption = this.Caption.Get(context) ?? string.Empty;
            string text    = this.Text.Get(context) ?? string.Empty;

            System.Windows.MessageBoxButton  buttons = this.Buttons.Get(context);
            System.Windows.MessageBoxImage   icon    = this.Icon.Get(context);
            System.Windows.MessageBoxOptions options = this.Options.Get(context);

            Result.Set(context, System.Windows.MessageBox.Show(text, caption, buttons, icon, System.Windows.MessageBoxResult.None, options));
        }
 public EditorViewModel()
 {
     IncreaseText = new DelegateCommand(_ =>
     {
         ++FontSize;
         OnPropertyChanged();
     });
     DecreaseText = new DelegateCommand(_ =>
     {
         if (FontSize > 1)
         {
             --FontSize;
             OnPropertyChanged();
         }
     });
     New = new DelegateCommand(_ => {
         if (IsDirty)
         {
             string messageBoxText = "You have unsaved changes. Do you want to save?";
             string caption        = "Unsaved changes";
             System.Windows.MessageBoxButton button = System.Windows.MessageBoxButton.YesNoCancel;
             System.Windows.MessageBoxImage icon    = System.Windows.MessageBoxImage.Warning;
             System.Windows.MessageBoxResult result = System.Windows.MessageBox.Show(messageBoxText, caption, button, icon);
             if (result == System.Windows.MessageBoxResult.Yes)
             {
                 SaveFile?.Invoke(this, new FileOperationEventArgs(null, CurrentText, IsDirty));
                 IsDirty     = false;
                 CurrentText = "";
                 LineNumbers = "";
             }
             else if (result == System.Windows.MessageBoxResult.No)
             {
                 NewFile?.Invoke(this, null);
             }
         }
     });
     Save = new DelegateCommand(_ => {
         if (IsDirty)
         {
             SaveFile?.Invoke(this, new FileOperationEventArgs(null, CurrentText, IsDirty));
             IsDirty = false;
         }
     });
     Open = new DelegateCommand(_ => {
         OpenFile?.Invoke(this, new FileOperationEventArgs(null, null, IsDirty));
     });
 }
Esempio n. 5
0
        /// <summary>
        /// Displays a message box to the user.
        /// </summary>
        /// <param name="message">The message that is to be displayed.</param>
        /// <param name="title">The title of the message box.</param>
        /// <param name="messageBoxButton">Determines the buttons that are displayed in the message box.</param>
        /// <param name="messageBoxIcon">Determines the icon that is displayed in the message box.</param>
        /// <returns>Returns the result of the message box, which contains the button that was clicked by the user.</returns>
        public virtual async Task <DialogResult> ShowMessageBoxDialogAsync(string message, string title, MessageBoxButton messageBoxButton, MessageBoxIcon messageBoxIcon)
        {
            // Since the message box must be invoked on the UI thread, the invocation is dispatched to the UI thread
            return(await this.applicationService.CurrentDispatcher.InvokeAsync(() =>
            {
                // Get the message box buttons that are to be displayed
                System.Windows.MessageBoxButton buttons = (System.Windows.MessageBoxButton)messageBoxButton;

                // Get the message box icon that is to be displayed
                System.Windows.MessageBoxImage icon = (System.Windows.MessageBoxImage)messageBoxIcon;

                // Prompt the message
                System.Windows.MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(message, title, buttons, icon);

                // Returns the result of the message box invocation
                return (DialogResult)messageBoxResult;
            }));
        }
Esempio n. 6
0
 public System.Windows.MessageBoxResult ShowMessageBox(string text, string title, System.Windows.MessageBoxButton buttons)
 {
     return(System.Windows.MessageBox.Show(text, title, buttons));
 }
Esempio n. 7
0
 protected System.Windows.MessageBoxResult ShowMessageBox(string Message, System.Windows.MessageBoxButton MessageBoxButton, System.Windows.MessageBoxImage MessageBoxImage, System.Windows.MessageBoxResult DefaultResult)
 {
     return(System.Windows.MessageBox.Show(this.Owner, Message, this.WindowTitle, MessageBoxButton, MessageBoxImage, DefaultResult));
 }
Esempio n. 8
0
        static MessageBoxDefaultButton Convert(System.Windows.MessageBoxResult result, System.Windows.MessageBoxButton buttons)
        {
            switch (result)
            {
            case System.Windows.MessageBoxResult.No:
                return(MessageBoxDefaultButton.Button2);

            case System.Windows.MessageBoxResult.Cancel:
                return(buttons == System.Windows.MessageBoxButton.OKCancel ?
                       MessageBoxDefaultButton.Button2 : MessageBoxDefaultButton.Button3);

            default:
                return(MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 9
0
 static MessageBoxButtons Convert(System.Windows.MessageBoxButton button)
 {
     return((MessageBoxButtons)(int)button);
 }
Esempio n. 10
0
 static public bool MessageBoxIsOK(string message, string caption, System.Windows.MessageBoxButton buttons, System.Windows.MessageBoxImage icon)
 {
     return(System.Windows.MessageBox.Show(message, caption, buttons, icon) == System.Windows.MessageBoxResult.OK);
 }
Esempio n. 11
0
 public System.Windows.MessageBoxResult ShowMessageBox(INotifyPropertyChanged ownerViewModel, string messageBoxText, string caption = "", System.Windows.MessageBoxButton button = 0, System.Windows.MessageBoxImage icon = 0, System.Windows.MessageBoxResult defaultResult = 0)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public System.Windows.MessageBoxResult Show(string message, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon)
 {
     return(System.Windows.MessageBox.Show(message, "MESSAGE", button, icon));
 }
Esempio n. 13
0
 public static System.Windows.MessageBoxResult Show(System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult, System.Windows.MessageBoxOptions options)
 {
     return(System.Windows.MessageBox.Show(owner: owner, messageBoxText: messageBoxText, caption: caption, button: button, icon: icon, defaultResult: defaultResult, options: options | System.Windows.MessageBoxOptions.RightAlign | System.Windows.MessageBoxOptions.RtlReading));
 }
Esempio n. 14
0
 public static System.Windows.MessageBoxResult Show(System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon)
 {
     return(System.Windows.MessageBox.Show(owner: owner, messageBoxText: messageBoxText, caption: caption, button: button, icon: icon));
 }
Esempio n. 15
0
 public static System.Windows.MessageBoxResult Show(string messageBoxText, string caption, System.Windows.MessageBoxButton button)
 {
     return(System.Windows.MessageBox.Show(messageBoxText: messageBoxText, caption: caption, button: button));
 }
 public MessageBoxResult ShowWindowsMessageBox(string message, string caption,
                                               System.Windows.MessageBoxButton button = System.Windows.MessageBoxButton.OK)
 {
     return(new MessageBoxResult(message, caption, button));
 }