public static MessageBoxResult Show(
            Action<Window> setOwner,
            CultureInfo culture,
            string messageBoxText,
            string caption,
            WPFMessageBoxButton button,
            MessageBoxImage icon,
            MessageBoxResult defaultResult,
            MessageBoxOptions options)
        {
            if ((options & MessageBoxOptions.DefaultDesktopOnly) == MessageBoxOptions.DefaultDesktopOnly)
            {
                throw new NotImplementedException();
            }

            if ((options & MessageBoxOptions.ServiceNotification) == MessageBoxOptions.ServiceNotification)
            {
                throw new NotImplementedException();
            }
            //LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("de");
            _messageBoxWindow = new WPFMessageBoxWindow();

            setOwner(_messageBoxWindow);

            PlayMessageBeep(icon);
            //FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
            //            XmlLanguage.GetLanguage(culture.IetfLanguageTag)));
            _messageBoxWindow._viewModel = new MessageBoxViewModel(_messageBoxWindow, culture, caption, messageBoxText, button, icon, defaultResult, options);
            _messageBoxWindow.DataContext = _messageBoxWindow._viewModel;
            _messageBoxWindow.ShowDialog();
            return _messageBoxWindow._viewModel.Result;
        }
        public static MessageBoxResult Show(
            Action<Window> setOwner,
            string messageBoxText, 
            string caption, 
            MessageBoxButton button, 
            MessageBoxImage icon, 
            MessageBoxResult defaultResult, 
            MessageBoxOptions options)
        {
            if ((options & MessageBoxOptions.DefaultDesktopOnly) == MessageBoxOptions.DefaultDesktopOnly)
            {
                throw new NotImplementedException();
            }

            if ((options & MessageBoxOptions.ServiceNotification) == MessageBoxOptions.ServiceNotification)
            {
                throw new NotImplementedException();
            }

            _messageBoxWindow = new WpfMessageBoxWindow();

            setOwner(_messageBoxWindow);

            PlayMessageBeep(icon);

            _messageBoxWindow._viewModel = new MessageBoxViewModel(_messageBoxWindow, caption, messageBoxText, button, icon, defaultResult, options);
            _messageBoxWindow.DataContext = _messageBoxWindow._viewModel;
            _messageBoxWindow.ShowDialog();
            return _messageBoxWindow._viewModel.Result;
        }
Пример #3
0
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
 {
     _owner = owner;
     Initialize();
     return MessageBox.Show(owner, text, caption, buttons, icon,
                            defButton, options);
 }
Пример #4
0
 public AlertDialogBackend()
 {
     this.buttons = MessageBoxButton.OKCancel;
     this.icon = MessageBoxImage.None;
     this.options = MessageBoxOptions.None;
     this.defaultResult = MessageBoxResult.Cancel;
 }
Пример #5
0
        private KryptonMessageBox(string text, string caption,
                                  MessageBoxButtons buttons, MessageBoxIcon icon,
                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
                                  HelpInfo helpInfo)
        {
            // Store incoming values
            _text = text;
            _caption = caption;
            _buttons = buttons;
            _icon = icon;
            _defaultButton = defaultButton;
            _options = options;
            _helpInfo = helpInfo;

            // Create the form contents
            InitializeComponent();

            // Update contents to match requirements
            UpdateText();
            UpdateIcon();
            UpdateButtons();
            UpdateDefault();
            UpdateHelp();

            // Finally calculate and set form sizing
            UpdateSizing();
        }
 /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show6"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Displays a message box with specified text, caption, and style.
 ///       Makes the dialog RTL if the resources for this dll have been localized to a RTL language.
 ///    </para>
 /// </devdoc>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, 
                                 MessageBoxDefaultButton defaultButton, MessageBoxOptions options) {
     if (RTLAwareMessageBox.IsRTLResources) {
         options |= (MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
     }
     return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
 }
Пример #7
0
 ///-------------------------------------------------------------------------------------------------
 /// <summary>   Shows. </summary>
 ///
 /// <remarks>   Justin, 7/11/2015. </remarks>
 ///
 /// <param name="message">              The message. </param>
 /// <param name="result">               The result. </param>
 /// <param name="state">                The state. </param>
 /// <param name="ok">                   The ok. </param>
 /// <param name="messageBoxIcon">       The message box icon. </param>
 /// <param name="button1">              The first button. </param>
 /// <param name="serviceNotification">  The service notification. </param>
 ///-------------------------------------------------------------------------------------------------
 public static void Show(string message, string result, TcpState state, MessageBoxButtons ok, MessageBoxIcon messageBoxIcon,
     MessageBoxDefaultButton button1, MessageBoxOptions serviceNotification)
 {
     MessageBox.Show(String.Format("{0} result: {1}, Tcp State: {2}", message, result, state),
         @"Information", ok,
         messageBoxIcon, button1,
         serviceNotification);
 }
Пример #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This implementation displays the message in the Console and returns the first
		/// button as dialog result.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public DialogResult Show(IWin32Window owner, string text, string caption,
			MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton,
			MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param)
		{
			Console.WriteLine("**** {0}: {1}{3}{2}", caption, text, buttons, Environment.NewLine);

			return TranslateButtons(buttons);
		}
Пример #9
0
 public static DialogResult Show(IWin32Window owner, string text, 
     string caption, MessageBoxButtons buttons, MessageBoxIcon icon, 
     MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
 {
     
     return MessageBox.Show(owner, text, caption,
         buttons, icon, defaultButton, getDefaultOptions(owner) | options);
 }
Пример #10
0
        //public DialogEventArgs(string text, string caption)
        //    : this(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, 0)
        //{
        //}

        public DialogEventArgs(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            this.text = text;
            this.caption = caption;
            this.buttons = buttons;
            this.icon = icon;
            this.defaultButton = defaultButton;
            this.options = options;
        }
Пример #11
0
        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons,
            MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            if (IsRightToLeft(owner))
            {
                options |= MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign;
            }

            return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
        }
Пример #12
0
 public static DialogResult Show(
     string text,
     string caption,
     MessageBoxButtons buttons,
     MessageBoxIcon icon,
     MessageBoxDefaultButton defaultButton,
     MessageBoxOptions options )
 {
     return MessageBox.Show( text, caption, buttons, icon, defaultButton, options );
 }
Пример #13
0
        public CustomMessageBox()
        {
            m_messageBoxButtons = MessageBoxButtons.OK;
            m_messageBoxDefaultButton = MessageBoxDefaultButton.Button1;
            m_messageIcon = MessageIcon.None;
            m_messageBoxOptions = 0;
            m_helpNavigator = HelpNavigator.Topic;
            m_variableDictionary = new Dictionary<string, object>();

            InitializeComponent();
        }
Пример #14
0
 public DialogResult ShowMessage(
     string text,
     string caption,
     MessageBoxButtons buttons,
     MessageBoxIcon icon,
     MessageBoxDefaultButton defaultButton,
     MessageBoxOptions options,
     string helpFilePath)
 {
     return MessageBox.Show(text, caption, buttons, icon, defaultButton, options, helpFilePath);
 }
Пример #15
0
 public DialogResult ShowMessage(
     string text,
     string caption,
     MessageBoxButtons buttons,
     MessageBoxIcon icon,
     MessageBoxDefaultButton defaultButton,
     MessageBoxOptions options,
     bool displayHelpButton)
 {
     return MessageBox.Show(text, caption, buttons, icon, defaultButton, options, displayHelpButton);
 }
        public void ShowMessageBox(string message, string title = "Hello Screens", MessageBoxOptions options = MessageBoxOptions.Ok, Action<IMessageBox> callback = null) {
            var box = createMessageBox();

            box.DisplayName = title;
            box.Options = options;
            box.Message = message;

            if(callback != null)
                box.Deactivated += delegate { callback(box); };

            ActivateItem(box);
        }
Пример #17
0
 public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
 {
     MessageBoxResult result = defaultResult;
     Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                 () =>
               {
                 Window newWindow = new Window() { Topmost = true };
                 result = MessageBox.Show(newWindow, messageBoxText, caption, button, icon, defaultResult, options);
                 newWindow.Close();
               }));
     return (result);
 }
Пример #18
0
 public DialogResult ShowMessage(
     string text,
     string caption,
     MessageBoxButtons buttons,
     MessageBoxIcon icon,
     MessageBoxDefaultButton defaultButton,
     MessageBoxOptions options,
     string helpFilePath,
     HelpNavigator navigator,
     object param)
 {
     return MessageBox.Show(text, caption, buttons, icon, defaultButton, options, helpFilePath, navigator, param);
 }
		public void Show(string title, string message, MessageBoxTypes type, MessageBoxOptions options, MessageBoxCallback callback)
		{
			if (type == MessageBoxTypes.Ok)
			{
				EditorUtility.DisplayDialog(title, message, options.OkButtonName);
				if (callback != null) callback(MessageBoxResult.Ok);
			}
			else
			{
				bool value = EditorUtility.DisplayDialog(title, message, options.OkButtonName, options.CancelButtonText);
				if (callback != null) callback(value ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
			}
		}
		public void Show(string title, string message, MessageBoxTypes type, MessageBoxOptions options, MessageBoxCallback callback)
		{
			if (type == MessageBoxTypes.Ok)
			{
				MessageBoxShow(title, message, 0);
				if (callback != null) callback(MessageBoxResult.Ok);
			}
			else
			{
				int result = MessageBoxShow(title, message, 1);
				Debug.Log("VALUE: " + result);
				if (callback != null) callback(result == 1 ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
			}
		}
		private async void showAsync(string title, string message, MessageBoxTypes type, MessageBoxOptions options, MessageBoxCallback callback)
		#endif
		{
			#if WINDOWS_PHONE
			WinRTPlugin.Dispatcher.BeginInvoke(delegate()
			{
				// XNA method
				Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(title, message,
				new System.Collections.Generic.List<string> {options.OkButtonName, options.CancelButtonText}, 0, Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.Error,
				asyncResult =>
				{
					int? result = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(asyncResult);
					ReignServices.InvokeOnUnityThread(delegate
					{
						if (callback != null) callback(result == 0 ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
					});
				}, null);

				// Silverlight method. (Doesn't support custom named buttons)
				//var result = MessageBox.Show(message, title, type == MessageBoxTypes.Ok ? MessageBoxButton.OK : MessageBoxButton.OKCancel);
				//if (callback != null) callback(result == System.Windows.MessageBoxResult.OK ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
			});
			#else
			await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate()
			{
				var msg = new MessageDialog(message, title);
				if (type == MessageBoxTypes.Ok)
				{
					await msg.ShowAsync();
					ReignServices.InvokeOnUnityThread(delegate
					{
						if (callback != null) callback(MessageBoxResult.Ok);
					});
				}
				else if (type == MessageBoxTypes.OkCancel)
				{
					bool result = false;
					msg.Commands.Add(new UICommand(options.OkButtonName, new UICommandInvokedHandler((cmd) => result = true)));
					msg.Commands.Add(new UICommand(options.CancelButtonText, new UICommandInvokedHandler((cmd) => result = false)));
					await msg.ShowAsync();
					ReignServices.InvokeOnUnityThread(delegate
					{
						if (callback != null) callback(result ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
					});
				}
			});
			#endif
		}
Пример #22
0
		/// <summary>
		/// Display a MessageBox
		/// </summary>
		/// <param name="messageBoxText">A System.String that specifies the text to display.</param>
		/// <param name="caption">A System.String that specifies the title bar caption to display.</param>
		/// <param name="buttons">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
		/// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
		/// <param name="defaultResult">A System.Windows.MessageBoxResult value that specifies the default result of the message box.</param>
		/// <param name="cancelResult">A System.Windows.MessageBoxResult value that specifies the cancel result of the message box</param>
		/// <param name="options">A System.Windows.MessageBoxOptions value object that specifies the options.</param>
		/// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
		/// <returns>The result chosen by the user</returns>
		public MessageBoxResult ShowMessageBox(string messageBoxText, string caption = "",
				MessageBoxButton buttons = MessageBoxButton.OK,
				MessageBoxImage icon = MessageBoxImage.None,
				MessageBoxResult defaultResult = MessageBoxResult.None,
				MessageBoxResult cancelResult = MessageBoxResult.None,
				MessageBoxOptions options = MessageBoxOptions.None,
				IDictionary<MessageBoxResult, string> buttonLabels = null)
		{
			var vm = messageBoxViewModelFactory();
			vm.Setup(messageBoxText, caption, buttons, icon, defaultResult, cancelResult, options, buttonLabels);
			// Don't go through the IoC container to get the View. This means we can simplify it...
			var messageBoxView = new MessageBoxView();
			messageBoxView.InitializeComponent();
			viewManager.BindViewToModel(messageBoxView, vm);
			ShowDialog(vm);
			return vm.ClickedButton;
		}
        public MessageBoxViewModel(
            WpfMessageBoxWindow view,
            string title,
            string message,
            MessageBoxButton buttonOption,
            MessageBoxImage image,
            MessageBoxResult defaultResult,
            MessageBoxOptions options)
        {
            //TextAlignment
            Title = title;
            Message = message;
            ButtonOption = buttonOption;
            Options = options;

            SetDirections(options);
            SetButtonVisibility(buttonOption);
            SetImageSource(image);
            SetButtonDefault(defaultResult);
            _view = view;
        }
Пример #24
0
 /// <summary>
 ///    <para>
 ///       Displays a message box with specified text, caption, and style.
 ///    </para>
 /// </summary>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
                                 MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
 {
     return(ShowCore(owner, text, caption, buttons, icon, defaultButton, options, false));
 }
Пример #25
0
        private static DialogResult ShowCore(IWin32Window owner, string text, string caption,
                                             MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton,
                                             MessageBoxOptions options, bool showHelp)
        {
            if (!ClientUtils.IsEnumValid(buttons, (int)buttons, (int)MessageBoxButtons.OK, (int)MessageBoxButtons.RetryCancel))
            {
                throw new InvalidEnumArgumentException(nameof(buttons), (int)buttons, typeof(MessageBoxButtons));
            }

            // valid values are 0x0 0x10 0x20 0x30 0x40, chop off the last 4 bits and check that it's between 0 and 4.
            if (!WindowsFormsUtils.EnumValidator.IsEnumWithinShiftedRange(icon, /*numBitsToShift*/ 4, /*min*/ 0x0, /*max*/ 0x4))
            {
                throw new InvalidEnumArgumentException(nameof(icon), (int)icon, typeof(MessageBoxIcon));
            }
            // valid values are 0x0 0x100, 0x200, chop off the last 8 bits and check that it's between 0 and 2.
            if (!WindowsFormsUtils.EnumValidator.IsEnumWithinShiftedRange(defaultButton, /*numBitsToShift*/ 8, /*min*/ 0x0, /*max*/ 0x2))
            {
                throw new InvalidEnumArgumentException(nameof(defaultButton), (int)defaultButton, typeof(DialogResult));
            }

            // options intentionally not verified because we don't expose all the options Win32 supports.

            if (!SystemInformation.UserInteractive && (options & (MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly)) == 0)
            {
                throw new InvalidOperationException(SR.CantShowModalOnNonInteractive);
            }
            if (owner != null && (options & (MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly)) != 0)
            {
                throw new ArgumentException(SR.CantShowMBServiceWithOwner, "options");
            }
            if (showHelp && (options & (MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly)) != 0)
            {
                throw new ArgumentException(SR.CantShowMBServiceWithHelp, "options");
            }

            int style = (showHelp) ? HELP_BUTTON : 0;

            style |= (int)buttons | (int)icon | (int)defaultButton | (int)options;

            IntPtr handle = IntPtr.Zero;

            if (showHelp || ((options & (MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly)) == 0))
            {
                if (owner == null)
                {
                    handle = UnsafeNativeMethods.GetActiveWindow();
                }
                else
                {
                    handle = Control.GetSafeHandle(owner);
                }
            }

            IntPtr userCookie = IntPtr.Zero;

            if (Application.UseVisualStyles)
            {
                // CLR4.0 or later, shell32.dll needs to be loaded explicitly.
                if (UnsafeNativeMethods.GetModuleHandle(ExternDll.Shell32) == IntPtr.Zero)
                {
                    if (UnsafeNativeMethods.LoadLibraryFromSystemPathIfAvailable(ExternDll.Shell32) == IntPtr.Zero)
                    {
                        int lastWin32Error = Marshal.GetLastWin32Error();
                        throw new Win32Exception(lastWin32Error, string.Format(SR.LoadDLLError, ExternDll.Shell32));
                    }
                }

                // Activate theming scope to get theming for controls at design time and when hosted in browser.
                // NOTE: If a theming context is already active, this call is very fast, so shouldn't be a perf issue.
                userCookie = UnsafeNativeMethods.ThemingScope.Activate();
            }

            Application.BeginModalMessageLoop();
            DialogResult result;

            try
            {
                result = Win32ToDialogResult(SafeNativeMethods.MessageBox(new HandleRef(owner, handle), text, caption, style));
            }
            finally
            {
                Application.EndModalMessageLoop();
                UnsafeNativeMethods.ThemingScope.Deactivate(userCookie);
            }

            // Right after the dialog box is closed, Windows sends WM_SETFOCUS back to the previously active control
            // but since we have disabled this thread main window the message is lost. So we have to send it again after
            // we enable the main window.
            //
            UnsafeNativeMethods.SendMessage(new HandleRef(owner, handle), Interop.WindowMessages.WM_SETFOCUS, 0, 0);
            return(result);
        }
Пример #26
0
 private void ShowMessageBox(Action <MessageBoxResult> resultAction, string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, MessageBoxOptions options = MessageBoxOptions.None)
 {
     this.MessageBoxRequest?.Invoke(this, new MvvmMessageBoxEventArgs(resultAction, messageBoxText, caption, button, icon, defaultResult, options));
 }
        public void ShowMessage(string message, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options, Action <MessageBoxResult> action)
        {
            var res = MessageBox.Show(message, caption, button, icon, defaultResult, options);

            action?.Invoke(res);
        }
Пример #28
0
 public static DialogResult Show(object text, string caption = null, MessageBoxButtons buttons = 0, MessageBoxIcon icon = 0, MessageBoxDefaultButton defaultButton = 0, MessageBoxOptions options = 0)
 {
     return((DialogResult)NativeMessageBox(IntPtr.Zero, text?.ToString() ?? "<null>", caption, (int)buttons | (int)icon | (int)defaultButton | (int)options));
 }
Пример #29
0
        private ScrollableMessageBox(string text, string caption = null, MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxDefaultButton defButton = MessageBoxDefaultButton.Button1, MessageBoxOptions options = 0)
        {
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            InitializeComponent();
            this.UpdateLightDarkMode();

            txtText.Text = text;
            txtText.AutoSetScrollbars();
            Text         = string.IsNullOrWhiteSpace(caption) ? string.Empty : caption;
            _eBoxButtons = buttons;
            switch (buttons)
            {
            case MessageBoxButtons.OK:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.OK);
                tlpButtons.Controls.Remove(cmdButton2);
                tlpButtons.Controls.Remove(cmdButton3);
                cmdButton2.Dispose();
                cmdButton2 = null;
                cmdButton3.Dispose();
                cmdButton3 = null;
                break;

            case MessageBoxButtons.OKCancel:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Cancel);
                cmdButton2.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.OK);
                tlpButtons.Controls.Remove(cmdButton3);
                cmdButton3.Dispose();
                cmdButton3 = null;
                break;

            case MessageBoxButtons.AbortRetryIgnore:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Ignore);
                cmdButton2.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Retry);
                cmdButton3.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Abort);
                break;

            case MessageBoxButtons.YesNoCancel:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Cancel);
                cmdButton2.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.No);
                cmdButton3.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Yes);
                break;

            case MessageBoxButtons.YesNo:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.No);
                cmdButton2.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Yes);
                tlpButtons.Controls.Remove(cmdButton3);
                cmdButton3.Dispose();
                cmdButton3 = null;
                break;

            case MessageBoxButtons.RetryCancel:
                cmdButton1.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Cancel);
                cmdButton2.Text = NativeMethods.GetSystemString(NativeMethods.SystemString.Retry);
                tlpButtons.Controls.Remove(cmdButton3);
                cmdButton3.Dispose();
                cmdButton3 = null;
                break;
            }

            switch (icon)
            {
            case MessageBoxIcon.None:
                imgIcon.Visible = false;
                break;

            case MessageBoxIcon.Error:
                imgIcon.Image = Utils.StockIconBitmapsForSystemIcons[SystemIcons.Error];
                break;

            case MessageBoxIcon.Question:
                imgIcon.Image = Utils.StockIconBitmapsForSystemIcons[SystemIcons.Question];
                break;

            case MessageBoxIcon.Warning:
                imgIcon.Image = Utils.StockIconBitmapsForSystemIcons[SystemIcons.Warning];
                break;

            case MessageBoxIcon.Information:
                imgIcon.Image = Utils.StockIconBitmapsForSystemIcons[SystemIcons.Information];
                break;
            }

            if (options.HasFlag(MessageBoxOptions.ServiceNotification) || options.HasFlag(MessageBoxOptions.DefaultDesktopOnly))
            {
                StartPosition = FormStartPosition.CenterScreen;
            }
            if (options.HasFlag(MessageBoxOptions.RightAlign))
            {
                txtText.TextAlign = HorizontalAlignment.Right;
            }
            if (options.HasFlag(MessageBoxOptions.RtlReading))
            {
                txtText.RightToLeft = RightToLeft.Yes;
            }

            switch (defButton)
            {
            case MessageBoxDefaultButton.Button2:
                if (cmdButton2 != null)
                {
                    cmdButton2.Focus();
                }
                else
                {
                    cmdButton1.Focus();
                }
                break;

            case MessageBoxDefaultButton.Button3:
                cmdButton1.Focus();
                break;

            default:
                if (cmdButton3 != null)
                {
                    cmdButton3.Focus();
                }
                else if (cmdButton2 != null)
                {
                    cmdButton2.Focus();
                }
                else
                {
                    cmdButton1.Focus();
                }
                break;
            }
        }
Пример #30
0
 public static extern uint MessageBox(IntPtr hWnd, String text, String caption, MessageBoxOptions options);
Пример #31
0
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
 {
     _owner = owner;
     Initialize();
     return(MessageBox.Show(owner, text, caption, buttons, icon,
                            defButton, options));
 }
Пример #32
0
 public static extern MessageBoxResult MessageBox(IntPtr hWnd, string text, string caption, MessageBoxOptions options);
Пример #33
0
 public static MessageBoxResult Show(Window owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
 {
     if (owner.Dispatcher.CheckAccess())
     {
         owner.CenterChild();
         return MessageBox.Show(owner, messageBoxText, caption, button, icon, defaultResult, options);
     }
     else
     {
         return (MessageBoxResult)owner.Dispatcher.Invoke(new Func<MessageBoxResult>(() =>
         {
             owner.CenterChild();
             return MessageBox.Show(owner, messageBoxText, caption, button, icon, defaultResult, options);
         }));
     }
 }
	public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, string keyword) {}
Пример #35
0
 public void ShowError(MessageBoxOptions options)
 {
     MessageBox.Show(".אירעה שגיאה, נסה שוב מאוחר יותר\nשגיאה זו נגרמת בדרך כלל עקב בעיות זכויות יוצרים או מפאת אורכו של הווידאו\nאנו תומכים רק בקטעי וידאו עם מקסימום של 20 דקות", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, options);
 }
Пример #36
0
        private void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            //int TransactID1 = 0;
            string notes       = "";
            string account_no  = "";
            string address1    = "";
            string address2    = "";
            string city        = "";
            string state       = "";
            string state_other = "";
            string zip         = "";
            string country     = "";
            string postal_code = "";
            string areacode    = "";
            string phone       = "";
            string email       = "";
            string website     = "";
            string rep         = "";
            string name        = "";

            System.Windows.Data.CollectionViewSource uSP_getOneVendorViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("uSP_getOneVendorViewSource")));

            coolBlue.vendorDataSet VendorDataSet = ((coolBlue.vendorDataSet)(this.FindResource("vendorDataSet")));


            //int accountCurrent = 0;
            int wasnull = 0;

            wasnull = (uSP_getOneVendorViewSource.View == null ? 1 : 0);
            if (wasnull == 1)
            {
                // MessageBox.Show("Warning: uSP_getLineViewSource is null", "CoolBlue");
                string message = "Warning:uSP_getOneVendorViewSource is null";
                string caption = "CoolBlue";

                MessageBoxButton  buttons       = MessageBoxButton.OK;
                MessageBoxImage   icon          = MessageBoxImage.Information;
                MessageBoxResult  defaultResult = MessageBoxResult.OK;
                MessageBoxOptions options       = MessageBoxOptions.RtlReading;
                // Show message box
                // MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon, defaultResult, options);

                // Displays the MessageBox.
                MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon, defaultResult, options);

                if (result == MessageBoxResult.OK)
                {
                    // Closes the parent form.

                    //this.Close();
                }
                return;
            }
            else
            {
                DataRowView drv = (DataRowView)uSP_getOneVendorViewSource.View.CurrentItem;
                //accountCurrent = (drv == null ? 0 : DBNull.Value.Equals(drv["ID"]) == true ? 0 : (int)drv["ID"]);
                notes       = (DBNull.Value.Equals(drv["notes"]) == true ? "" : (string)drv["notes"]);
                account_no  = (DBNull.Value.Equals(drv["account_no"]) == true ? "" : (string)drv["account_no"]);
                address1    = (DBNull.Value.Equals(drv["address1"]) == true ? "" : (string)drv["address1"]);
                address2    = (DBNull.Value.Equals(drv["address2"]) == true ? "" : (string)drv["address2"]);
                city        = (DBNull.Value.Equals(drv["city"]) == true ? "" : (string)drv["city"]);
                state       = (DBNull.Value.Equals(drv["state"]) == true ? "" : (string)drv["state"]);
                state_other = (DBNull.Value.Equals(drv["state_other"]) == true ? "" : (string)drv["state_other"]);
                zip         = (DBNull.Value.Equals(drv["zip"]) == true ? "" : (string)drv["zip"]);
                country     = (DBNull.Value.Equals(drv["country"]) == true ? "" : (string)drv["country"]);
                postal_code = (DBNull.Value.Equals(drv["postal_code"]) == true ? "" : (string)drv["postal_code"]);
                areacode    = (DBNull.Value.Equals(drv["areacode"]) == true ? "" : (string)drv["areacode"]);
                phone       = (DBNull.Value.Equals(drv["phone"]) == true ? "" : (string)drv["phone"]);
                email       = (DBNull.Value.Equals(drv["email"]) == true ? "" : (string)drv["email"]);
                website     = (DBNull.Value.Equals(drv["website"]) == true ? "" : (string)drv["website"]);
                rep         = (DBNull.Value.Equals(drv["rep"]) == true ? "" : (string)drv["rep"]);
                name        = (DBNull.Value.Equals(drv["name"]) == true ? "" : (string)drv["name"]);
            }



            SqlConnection conn = new SqlConnection()
            {
                ConnectionString = ProgramSettings.coolblueconnectionString
            };

            try
            {
                using (SqlCommand cmd3 = new SqlCommand()
                {
                    Connection = conn, CommandType = CommandType.StoredProcedure
                })
                {
                    //cmd3.Transaction = trans1;
                    cmd3.Parameters.Clear();
                    cmd3.CommandText = "dbo.USP_updateVendor";
                    cmd3.Parameters.AddWithValue("@ID", nVendorID);
                    cmd3.Parameters.AddWithValue("@notes", notes);
                    cmd3.Parameters.AddWithValue("@account_no", account_no);
                    cmd3.Parameters.AddWithValue("@address1", address1);
                    cmd3.Parameters.AddWithValue("@address2", address2);
                    cmd3.Parameters.AddWithValue("@city", city);
                    cmd3.Parameters.AddWithValue("@state", state);
                    cmd3.Parameters.AddWithValue("@state_other", state_other);
                    cmd3.Parameters.AddWithValue("@zip", zip);
                    cmd3.Parameters.AddWithValue("@country", country);
                    cmd3.Parameters.AddWithValue("@postal_code", postal_code);
                    cmd3.Parameters.AddWithValue("@areacode", areacode);
                    cmd3.Parameters.AddWithValue("@phone", phone);
                    cmd3.Parameters.AddWithValue("@email", email);
                    cmd3.Parameters.AddWithValue("@website", website);
                    cmd3.Parameters.AddWithValue("@rep", rep);
                    cmd3.Parameters.AddWithValue("@name", name);


                    //SqlParameter retval = cmd3.Parameters.Add("@transactIdentity", SqlDbType.Int);
                    //retval.Direction = ParameterDirection.Output;
                    conn.Open();
                    cmd3.ExecuteNonQuery();
                    //TransactID1 = (int)cmd3.Parameters["@transactIdentity"].Value;
                }
            }


            catch (Exception ex)
            {
                //utilities.errorLog(System.Reflection.MethodInfo.GetCurrentMethod().Name, ex);
                System.ArgumentException argEx = new System.ArgumentException("New Line", "", ex);
                throw argEx;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                //VendorDataSet.EnforceConstraints = false;

                //coolBlue.vendorDataSetTableAdapters.USP_getOneVendorTableAdapter vendorDataSetUSP_getOneVendorTableAdapter = new coolBlue.vendorDataSetTableAdapters.USP_getOneVendorTableAdapter();


                //vendorDataSetUSP_getOneVendorTableAdapter.Fill(VendorDataSet.USP_getOneVendor, nVendorID);

                //VendorDataSet.EnforceConstraints = true;

                //uSP_getLineDataGrid.

                //uSP_getAllAccountTypesUSP_getAllAccountsViewSource.View.MoveCurrentToPosition(0);

                //resetButtons();
                // LocateNewLine(TransactID1);
                this.Close();
            }
        }
Пример #37
0
 public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
 {
     return(MessageBox.Show(owner, messageBoxText, caption, button, icon, defaultResult, options));
 }
Пример #38
0
 /// <summary>
 /// Shows the exception.
 /// </summary>
 /// <param name="exceptionMessage">The exception message.</param>
 /// <param name="useKryptonMessageBox">if set to <c>true</c> [use krypton message box].</param>
 /// <param name="useExtendedKryptonMessageBox">if set to <c>true</c> [use extended krypton message box].</param>
 /// <param name="useWin32MessageBox">if set to <c>true</c> [use win32 message box].</param>
 /// <param name="useConsole">if set to <c>true</c> [use console].</param>
 /// <param name="useToolStripLabel">if set to <c>true</c> [use tool strip label].</param>
 /// <param name="toolStripLabel">The tool strip label.</param>
 /// <param name="args">The arguments.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="defaultButton">The default button.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="options">The options.</param>
 public void ShowException(string exceptionMessage, bool useKryptonMessageBox = false, bool useExtendedKryptonMessageBox = false, bool useWin32MessageBox = false, bool useConsole = false, bool useToolStripLabel = false, ToolStripLabel toolStripLabel = null, object args = null, string caption = "Exception Caught", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button3, MessageBoxIcon icon = MessageBoxIcon.Exclamation, MessageBoxOptions options = MessageBoxOptions.DefaultDesktopOnly)
 {
     if (useKryptonMessageBox)
     {
         KryptonMessageBox.Show(exceptionMessage, caption, buttons, icon, defaultButton, options);
     }
     else if (useExtendedKryptonMessageBox)
     {
     }
     else if (useWin32MessageBox)
     {
         MessageBox.Show(exceptionMessage, caption, buttons, icon, defaultButton, options);
     }
     else if (useConsole)
     {
         Console.WriteLine($"[ { DateTime.Now.ToString() } ]: { exceptionMessage }");
     }
 }
Пример #39
0
        public static async Task <MessageBoxResult> Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            if (caption == null)
            {
                throw new ArgumentNullException(nameof(caption));
            }
            if (messageBoxText == null)
            {
                throw new ArgumentNullException(nameof(messageBoxText));
            }

            // Button Strings
            var buttons = Buttons[button];

            // Show Message Window
            var win      = new CustomDialog(caption, messageBoxText, AcceptButtonID[button], CancelButtonID[button], buttons);
            var btnIndex = await win.ShowDialog <int?>(owner ?? App.Current.GetMainWindow());

            if (btnIndex != null && Enum.TryParse(buttons[btnIndex.Value], out MessageBoxResult result))
            {
                return(result);
            }

            return(defaultResult);
        }
Пример #40
0
        internal MessageBox2Form(Form objOwner, string strText, string strCaption, MessageBoxButtons enmButtons, MessageBoxIcon enmIcon, MessageBoxDefaultButton enmDefaultButton, MessageBoxOptions enmOptions, Font font = null)
            : base(objOwner == null ? ((Form)Global.Context.ActiveForm).Context : objOwner.Context)
        {
            InitializeComponent();

            Font defaultFont = objOwner == null ? null : objOwner.Font;

            if (font != null)
            {
                defaultFont = font;
            }

            menmButtons = enmButtons;

            menmDefaultButton = enmDefaultButton;

            int intButtonCount = 0;

            #region Buttons

            this.AddTableLayoutRowStyle(this.mobjButtonsLayout, new RowStyle(SizeType.Absolute, 26F));
            this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Percent, 50F));

            #region Button1

            intButtonCount++;

            // Resetting the AcceptButton and CancelButton properties of the Form.
            this.AcceptButton = this.CancelButton = null;

            // Set the first button.
            this.mobjButton1 = new MessageBoxButton();

            switch (menmButtons)
            {
            case MessageBoxButtons.OK:
                this.mobjButton1.Text         = WGLabels.Ok;
                this.mobjButton1.DialogResult = DialogResult.OK;

                // Setting the AcceptButton and CancelButton to their relevant buttons.
                this.AcceptButton = mobjButton1;
                this.CancelButton = mobjButton1;     // Using the newly created separate
                break;

            case MessageBoxButtons.OKCancel:
                this.mobjButton1.Text         = WGLabels.Ok;
                this.mobjButton1.DialogResult = DialogResult.OK;

                // Setting the AcceptButton to it's relevant button.
                this.AcceptButton = mobjButton1;
                break;

            case MessageBoxButtons.AbortRetryIgnore:
                this.mobjButton1.Text         = WGLabels.Abort;
                this.mobjButton1.DialogResult = DialogResult.Abort;
                break;

            case MessageBoxButtons.RetryCancel:
                this.mobjButton1.Text         = WGLabels.Retry;
                this.mobjButton1.DialogResult = DialogResult.Retry;
                break;

            case MessageBoxButtons.YesNo:
            case MessageBoxButtons.YesNoCancel:
                this.mobjButton1.Text         = WGLabels.Yes;
                this.mobjButton1.DialogResult = DialogResult.Yes;
                //this.mobjButton3 = null;
                break;
            }
            this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F));
            this.mobjButtonsLayout.Controls.Add(this.mobjButton1, 1, 0);

            #endregion

            #region Button2

            // Add the second button only if not OK.
            if (menmButtons != MessageBoxButtons.OK)
            {
                intButtonCount++;

                this.mobjButton2 = new MessageBoxButton();
                switch (menmButtons)
                {
                case MessageBoxButtons.OKCancel:
                case MessageBoxButtons.RetryCancel:
                    this.mobjButton2.Text         = WGLabels.Cancel;
                    this.mobjButton2.DialogResult = DialogResult.Cancel;

                    // Setting the CancelButton to it's relevant button.
                    this.CancelButton = mobjButton2;
                    break;

                case MessageBoxButtons.AbortRetryIgnore:
                    this.mobjButton2.Text         = WGLabels.Retry;
                    this.mobjButton2.DialogResult = DialogResult.Retry;
                    break;

                case MessageBoxButtons.YesNo:
                case MessageBoxButtons.YesNoCancel:
                    this.mobjButton2.Text         = WGLabels.No;
                    this.mobjButton2.DialogResult = DialogResult.No;
                    break;
                }
                this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 6F));
                this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F));
                this.mobjButtonsLayout.Controls.Add(this.mobjButton2, 3, 0);
            }

            #endregion

            #region Button3

            // Add the third button if is needed.
            if (menmButtons == MessageBoxButtons.AbortRetryIgnore || menmButtons == MessageBoxButtons.YesNoCancel)
            {
                intButtonCount++;

                this.mobjButton3 = new MessageBoxButton();
                switch (menmButtons)
                {
                case MessageBoxButtons.AbortRetryIgnore:
                    this.mobjButton3.Text         = WGLabels.Ignore;
                    this.mobjButton3.DialogResult = DialogResult.Ignore;
                    break;

                case MessageBoxButtons.YesNoCancel:
                    this.mobjButton3.Text         = WGLabels.Cancel;
                    this.mobjButton3.DialogResult = DialogResult.Cancel;

                    // Setting the CancelButton to it's relevant button.
                    this.CancelButton = mobjButton3;
                    break;
                }
                this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 6F));
                this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Absolute, 76F));
                this.mobjButtonsLayout.Controls.Add(this.mobjButton3, 5, 0);
            }

            #endregion

            this.AddTableLayoutColumnStyle(this.mobjButtonsLayout, new ColumnStyle(SizeType.Percent, 50F));

            #endregion

            #region Icon

            if (enmIcon != MessageBoxIcon.None)
            {
                this.mobjLabelText.Text = enmIcon.ToString();
                mobjIcon.Image          = new SkinResourceHandle(typeof(MessageBox), enmIcon.ToString() + ".gif");
            }
            else
            {
                // Remove icon layout
                this.Controls.Remove(this.mobjIconLayout);
            }

            #endregion

            #region Texts

            // Set description and caption - text values.
            this.mobjLabelText.Text = strText;
            this.Text = strCaption;

            if (this.Context != null && this.Context.MainForm != null)
            {
                objOwner = this.Context.MainForm as Form;
            }

            // Measure the description's text size.
            Size objTextsize = CommonUtils.GetStringMeasurements(strText, this.mobjLabelText.Font, objOwner.Width - (enmIcon == MessageBoxIcon.None ? 0 : mobjIcon.Width));

            // Calculate the messagebox sizes.
            int intWidth  = Math.Max(GetMinimalWidthForButtonsLayout(), objTextsize.Width) + (enmIcon == MessageBoxIcon.None ? 0 : mobjIconLayout.Width) + (this.Padding.All * 2);
            int intHeight = mobjButtonsLayout.Height + Math.Max((enmIcon == MessageBoxIcon.None ? 0 : mobjIcon.Height), objTextsize.Height) + 50;

            // Set the messagebox's calculated size.
            this.SuspendLayout();
            this.Size       = new Size(intWidth, intHeight);
            this.ClientSize = new Size(intWidth, intHeight);
            this.ResumeLayout(false);

            #endregion

            if (defaultFont != null)
            {
                this.Font = defaultFont;

                if (this.mobjButton1 != null)
                {
                    this.mobjButton1.Font = defaultFont;
                }
                if (this.mobjButton2 != null)
                {
                    this.mobjButton2.Font = defaultFont;
                }
                if (this.mobjButton3 != null)
                {
                    this.mobjButton3.Font = defaultFont;
                }

                if (this.mobjLabelText != null)
                {
                    this.mobjLabelText.Font = defaultFont;
                }
            }

            if (enmButtons == MessageBoxButtons.YesNo || enmButtons == MessageBoxButtons.AbortRetryIgnore)
            {
                this.CloseBox = false;
            }
        }
Пример #41
0
 public MessageBoxResult ShowMessage(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
 {
     return(MessageBoxResult.None);
 }
Пример #42
0
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options, uint uTimeout)
 {
     Setup(caption, uTimeout);
     return(MessageBox.Show(owner, text, caption, buttons, icon, defButton, options));
 }
Пример #43
0
 public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
 {
     Initialize();
     return(MessageBox.Show(text, caption, buttons, icon, defButton, options));
 }
Пример #44
0
        /// <summary>
        /// Displays a dialog box using the specified parameters.
        /// </summary>
        /// <param name="text">The text to display.</param>
        /// <param name="caption">The caption to display.</param>
        /// <param name="buttons">The buttons to display.</param>
        /// <param name="icon">The icon to display.</param>
        /// <param name="defaultButton">The default button for the dialog box.</param>
        /// <param name="options">A MessageBoxOptions object specifying an other options.</param>
        /// <returns>A DialogResult corresponding to the user's action on the dialog box.</returns>
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            if (IsRightToLeft())
            {
                options |= MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign;
            }

            return(MessageBox.Show(text, caption, buttons, icon, defaultButton, options));
        }
Пример #45
0
        //private double mintXFactor = 5.7;
        //private double mintYFactor = 15;

        #endregion Class Members

        #region C'Tor/D'Tor
        internal MessageBox2Form(string strText, string strCaption, MessageBoxButtons enmButtons, MessageBoxIcon enmIcon, MessageBoxDefaultButton enmDefaultButton, MessageBoxOptions enmOptions, Font font = null)
            : this((Form)Global.Context.ActiveForm, strText, strCaption, enmButtons, enmIcon, enmDefaultButton, enmOptions, font)
        {
        }
Пример #46
0
 public void Show(string title, string message, MessageBoxTypes type, MessageBoxOptions options, MessageBoxCallback callback)
 {
     this.callback = callback;
     ShowMessageBox(title, message, options.OkButtonName, options.CancelButtonText, type == MessageBoxTypes.Ok ? 0 : 1);
 }
Пример #47
0
        MessageBoxResult IMessageBoxService.Show(string messageBoxText, string caption, MessageBoxButton buttons, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            MessageBoxResult Result = MessageBox.Show(messageBoxText, caption, buttons, icon, defaultResult, options);

            return(Result);
            //throw new NotImplementedException();
        }
Пример #48
0
        public static async Task <MessageBoxResult> Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            Debug.WriteLine(caption);
            Debug.WriteLine(messageBoxText);

            // TODO: message box
            var buttons = Buttons[button];
            var win     = new CustomDialog(caption, messageBoxText, AcceptButtonID[button], CancelButtonID[button], buttons);

            win.Owner = owner;
            // TODO: add msgbox image
            var btnIndex = await win.ShowDialog <int?>();

            if (btnIndex == null)
            {
                return(defaultResult);
            }
            return((MessageBoxResult)Enum.Parse(typeof(MessageBoxResult), buttons[btnIndex.Value]));
            // return Task.FromResult(defaultResult);
        }
Пример #49
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //START WHIDBEY ADDS                                                                                           //
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        ///    <para>
        ///       Displays a message box with specified text, caption, and style with Help Button.
        ///    </para>
        /// </summary>
        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
                                        MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)
        {
            return(ShowCore(null, text, caption, buttons, icon, defaultButton, options, displayHelpButton));
        }
Пример #50
0
        public IActionResult Index()
        {
            if (HybridSupport.IsElectronActive)
            {
                var menu = new MenuItem[] {
                    new MenuItem {
                        Label = "Edit", Submenu = new MenuItem[] {
                            new MenuItem {
                                Label = "Undo", Accelerator = "CmdOrCtrl+Z", Role = MenuRole.undo
                            },
                            new MenuItem {
                                Label = "Redo", Accelerator = "Shift+CmdOrCtrl+Z", Role = MenuRole.redo
                            },
                            new MenuItem {
                                Type = MenuType.separator
                            },
                            new MenuItem {
                                Label = "Cut", Accelerator = "CmdOrCtrl+X", Role = MenuRole.cut
                            },
                            new MenuItem {
                                Label = "Copy", Accelerator = "CmdOrCtrl+C", Role = MenuRole.copy
                            },
                            new MenuItem {
                                Label = "Paste", Accelerator = "CmdOrCtrl+V", Role = MenuRole.paste
                            },
                            new MenuItem {
                                Label = "Select All", Accelerator = "CmdOrCtrl+A", Role = MenuRole.selectall
                            }
                        }
                    },
                    new MenuItem {
                        Label = "View", Submenu = new MenuItem[] {
                            new MenuItem
                            {
                                Label       = "Reload",
                                Accelerator = "CmdOrCtrl+R",
                                Click       = () =>
                                {
                                    // on reload, start fresh and close any old
                                    // open secondary windows
                                    Electron.WindowManager.BrowserWindows.ToList().ForEach(browserWindow => {
                                        if (browserWindow.Id != 1)
                                        {
                                            browserWindow.Close();
                                        }
                                        else
                                        {
                                            browserWindow.Reload();
                                        }
                                    });
                                }
                            },
                            new MenuItem
                            {
                                Label       = "Toggle Full Screen",
                                Accelerator = "CmdOrCtrl+F",
                                Click       = async() =>
                                {
                                    bool isFullScreen = await Electron.WindowManager.BrowserWindows.First().IsFullScreenAsync();

                                    Electron.WindowManager.BrowserWindows.First().SetFullScreen(!isFullScreen);
                                }
                            },
                            new MenuItem
                            {
                                Label       = "Open Developer Tools",
                                Accelerator = "CmdOrCtrl+I",
                                Click       = () => Electron.WindowManager.BrowserWindows.First().WebContents.OpenDevTools()
                            },
                            new MenuItem
                            {
                                Type = MenuType.separator
                            },
                            new MenuItem
                            {
                                Label = "App Menu Demo",
                                Click = async() => {
                                    var options = new MessageBoxOptions("This demo is for the Menu section, showing how to create a clickable menu item in the application menu.");
                                    options.Type  = MessageBoxType.info;
                                    options.Title = "Application Menu Demo";
                                    await Electron.Dialog.ShowMessageBoxAsync(options);
                                }
                            }
                        }
                    },
                    new MenuItem {
                        Label = "Window", Role = MenuRole.window, Submenu = new MenuItem[] {
                            new MenuItem {
                                Label = "Minimize", Accelerator = "CmdOrCtrl+M", Role = MenuRole.minimize
                            },
                            new MenuItem {
                                Label = "Quit", Accelerator = "CmdOrCtrl+W", Role = MenuRole.quit
                            }
                        }
                    },
                    new MenuItem {
                        Label = "Help", Role = MenuRole.help, Submenu = new MenuItem[] {
                            new MenuItem
                            {
                                Label = "Learn More",
                                Click = async() => await Electron.Shell.OpenExternalAsync("https://github.com/ElectronNET")
                            }
                        }
                    }
                };

                Electron.Menu.SetApplicationMenu(menu);

                CreateContextMenu();
            }

            return(View());
        }
Пример #51
0
        static int Main(string[] args)
        {
            #region Initialize Variables

            string                  message = DefaultMessage( );
            string                  result;
            string                  title         = defaulttitle;
            MessageBoxIcon          icon          = MessageBoxIcon.Information;
            MessageBoxDefaultButton defaultbutton = MessageBoxDefaultButton.Button1;
            MessageBoxOptions       option        = MessageBoxOptions.DefaultDesktopOnly;
            bool buttonsset    = false;
            bool defaultset    = false;
            bool escapemessage = true;
            bool iconset       = false;
            bool optionsset    = false;
            bool useswitches   = false;
            int  rc            = 0;

            #endregion Initialize Variables


            #region Command Line Parsing

            foreach (string arg in args)
            {
                if (arg == "/?")
                {
                    return(DisplayHelp( ));
                }
            }

            foreach (string arg in args)
            {
                if (arg[0] == '/')
                {
                    useswitches = true;
                    if (arg.Length > 3 && arg[2] == ':')
                    {
                        string key = arg[1].ToString( ).ToUpper( );
                        string val = arg.Substring(3).ToUpper( );
                        switch (key)
                        {
                        case "B":
                            switch (val)
                            {
                            case "A":
                            case "ABORTRETRYIGNORE":
                                buttons = MessageBoxButtons.AbortRetryIgnore;
                                break;

                            case "C":
                            case "OKCANCEL":
                                buttons = MessageBoxButtons.OKCancel;
                                break;

                            case "N":
                            case "YESNOCANCEL":
                                buttons = MessageBoxButtons.YesNoCancel;
                                break;

                            case "O":
                            case "OK":
                                buttons = MessageBoxButtons.OK;
                                break;

                            case "R":
                            case "RETRYCANCEL":
                                buttons = MessageBoxButtons.RetryCancel;
                                break;

                            case "Y":
                            case "YESNO":
                                buttons = MessageBoxButtons.YesNo;
                                break;

                            default:
                                rc = 1;
                                break;
                            }
                            buttonsset = true;
                            break;

                        case "D":
                            if (!buttonsset)
                            {
                                rc = 1;
                            }
                            switch (val)
                            {
                            case "1":
                            case "BUTTON1":
                            case "ABORT":
                            case "OK":
                            case "YES":
                                defaultbutton = MessageBoxDefaultButton.Button1;
                                break;

                            case "2":
                            case "BUTTON2":
                            case "NO":
                                defaultbutton = MessageBoxDefaultButton.Button2;
                                break;

                            case "3":
                            case "BUTTON3":
                            case "IGNORE":
                                defaultbutton = MessageBoxDefaultButton.Button3;
                                break;

                            case "CANCEL":
                                if (buttons == MessageBoxButtons.YesNoCancel)
                                {
                                    defaultbutton = MessageBoxDefaultButton.Button3;
                                }
                                else
                                {
                                    defaultbutton = MessageBoxDefaultButton.Button2;
                                }
                                break;

                            case "RETRY":
                                if (buttons == MessageBoxButtons.RetryCancel)
                                {
                                    defaultbutton = MessageBoxDefaultButton.Button1;
                                }
                                else
                                {
                                    defaultbutton = MessageBoxDefaultButton.Button2;
                                }
                                break;

                            default:
                                rc = 1;
                                break;
                            }
                            defaultset = true;
                            break;

                        case "I":
                            switch (val)
                            {
                            case "A":
                            case "ASTERISK":
                                icon = MessageBoxIcon.Asterisk;
                                break;

                            case "E":
                            case "ERROR":
                                icon = MessageBoxIcon.Error;
                                break;

                            case "H":
                            case "HAND":
                                icon = MessageBoxIcon.Hand;
                                break;

                            case "I":
                            case "INFORMATION":
                                icon = MessageBoxIcon.Information;
                                break;

                            case "N":
                            case "NONE":
                                icon = MessageBoxIcon.None;
                                break;

                            case "Q":
                            case "QUESTION":
                                icon = MessageBoxIcon.Question;
                                break;

                            case "S":
                            case "STOP":
                                icon = MessageBoxIcon.Stop;
                                break;

                            case "W":
                            case "WARNING":
                                icon = MessageBoxIcon.Warning;
                                break;

                            case "X":
                            case "EXCLAMATION":
                                icon = MessageBoxIcon.Exclamation;
                                break;

                            default:
                                rc = 1;
                                break;
                            }
                            iconset = true;
                            break;

                        case "O":
                            switch (val)
                            {
                            case "H":
                            case "HIDECONSOLE":
                                HideConsoleWindow( );
                                break;

                            case "L":
                            case "RTLREADING":
                                option |= MessageBoxOptions.RtlReading;
                                break;

                            case "N":
                            case "NOESCAPE":
                                escapemessage = false;
                                break;

                            case "R":
                            case "RIGHTALIGN":
                                option |= MessageBoxOptions.RightAlign;
                                break;

                            default:
                                rc = 1;
                                break;
                            }
                            optionsset = true;
                            break;

                        case "T":
                            rc = CheckTimeout(val);
                            break;

                        default:
                            rc = 1;
                            break;
                        }
                    }
                    else if (arg.ToUpper( ) == "/R")
                    {
                        rcbutton = true;
                    }
                    else
                    {
                        rc = 1;
                    }
                }
                else
                {
                    if (message == DefaultMessage( ))
                    {
                        message = arg;
                    }
                    else if (title == defaulttitle)
                    {
                        title = arg;
                    }
                    else if (useswitches)                       // If switches are used, only 2 "unnamed" arguments are allowed
                    {
                        rc = 1;
                    }
                    else if (!buttonsset)
                    {
                        switch (arg.ToLower( ))
                        {
                        case "abortretryignore":
                            buttons = MessageBoxButtons.AbortRetryIgnore;
                            break;

                        case "ok":
                            buttons = MessageBoxButtons.OK;
                            break;

                        case "okcancel":
                            buttons = MessageBoxButtons.OKCancel;
                            break;

                        case "retrycancel":
                            buttons = MessageBoxButtons.RetryCancel;
                            break;

                        case "yesno":
                            buttons = MessageBoxButtons.YesNo;
                            break;

                        case "yesnocancel":
                            buttons = MessageBoxButtons.YesNoCancel;
                            break;

                        default:
                            buttons = MessageBoxButtons.OK;
                            rc      = 1;
                            break;
                        }
                        buttonsset = true;
                    }
                    else if (!iconset)
                    {
                        switch (arg.ToLower( ))
                        {
                        case "asterisk":
                            icon = MessageBoxIcon.Asterisk;
                            break;

                        case "error":
                            icon = MessageBoxIcon.Error;
                            break;

                        case "exclamation":
                            icon = MessageBoxIcon.Exclamation;
                            break;

                        case "hand":
                            icon = MessageBoxIcon.Hand;
                            break;

                        case "information":
                            icon = MessageBoxIcon.Information;
                            break;

                        case "none":
                            icon = MessageBoxIcon.None;
                            break;

                        case "question":
                            icon = MessageBoxIcon.Question;
                            break;

                        case "stop":
                            icon = MessageBoxIcon.Stop;
                            break;

                        case "warning":
                            icon = MessageBoxIcon.Warning;
                            break;

                        default:
                            icon = MessageBoxIcon.Warning;
                            rc   = 1;
                            break;
                        }
                        iconset = true;
                    }
                    else if (!defaultset)
                    {
                        switch (arg.ToLower( ))
                        {
                        case "":
                        case "abort":
                        case "button1":
                        case "ok":
                        case "yes":
                            defaultbutton = MessageBoxDefaultButton.Button1;
                            break;

                        case "button2":
                        case "no":
                            defaultbutton = MessageBoxDefaultButton.Button2;
                            break;

                        case "button3":
                        case "ignore":
                            defaultbutton = MessageBoxDefaultButton.Button3;
                            break;

                        case "cancel":
                            if (args[2].ToLower( ) == "okcancel" || args[2].ToLower( ) == "retrycancel")
                            {
                                defaultbutton = MessageBoxDefaultButton.Button2;
                            }
                            else                                     // yesnocancel
                            {
                                defaultbutton = MessageBoxDefaultButton.Button3;
                            }
                            break;

                        case "retry":
                            if (args[2].ToLower( ) == "abortretryignore")
                            {
                                defaultbutton = MessageBoxDefaultButton.Button2;
                            }
                            else                                     // retrycancel
                            {
                                defaultbutton = MessageBoxDefaultButton.Button1;
                            }
                            break;

                        default:
                            defaultbutton = MessageBoxDefaultButton.Button1;
                            rc            = 1;
                            break;
                        }
                        defaultset = true;
                    }
                    else if (!optionsset)
                    {
                        switch (arg.ToLower( ))
                        {
                        case "":
                        case "none":
                            optionsset = true;
                            break;

                        case "hideconsole":
                            HideConsoleWindow( );
                            optionsset = true;
                            break;

                        case "noescape":
                            escapemessage = false;
                            optionsset    = true;
                            break;

                        case "rightalign":
                            option     = MessageBoxOptions.RightAlign;
                            optionsset = true;
                            break;

                        case "rtlreading":
                            option     = MessageBoxOptions.RtlReading;
                            optionsset = true;
                            break;

                        default:                                 // try if option is unspecified and argument is timeout
                            rc = CheckTimeout(arg);
                            break;
                        }
                    }
                    else if (timeout == 0)
                    {
                        rc = CheckTimeout(arg);
                    }
                    else
                    {
                        rc = 1;
                    }
                }
            }

            if (!escapemessage && message != DefaultMessage( ))
            {
                message = UnEscapeString(message);
                title   = UnEscapeString(title);
            }

            // MessageBoxOptions.ServiceNotification allows interactive use by SYSTEM account (or any other account not currently logged in)
            option |= MessageBoxOptions.ServiceNotification;

            #endregion Command Line Parsing


            if (rc == 1)               // command line error
            {
                ShowConsoleWindow( );
                return(DisplayHelp( ));
            }

            if (rc == 0 && timeout > 0)
            {
                result = AutoClosingMessageBox.Show(message, title, timeout, buttons, icon, defaultbutton, option).ToString( ).ToLower( );
                if (timeoutelapsed)
                {
                    result = "timeout";
                    rc     = 3;
                }
                else if (result == "cancel")
                {
                    rc = 2;
                }
            }
            else
            {
                if (message == DefaultMessage( ))
                {
                    message = DefaultMessage( ).Substring(0, DefaultMessage( ).IndexOf("\n\nNotes:")) + "\n\nWritten by Rob van der Woude\nhttp://www.robvanderwoude.com";
                    result  = System.Windows.Forms.MessageBox.Show(message, title, buttons, icon, defaultbutton, option).ToString( ).ToLower( );
                    Console.WriteLine(result);
                    if (result == "cancel")
                    {
                        return(2);
                    }
                    message = DefaultMessage( ).Substring(DefaultMessage( ).IndexOf("Notes:"));
                }
                result = System.Windows.Forms.MessageBox.Show(message, title, buttons, icon, defaultbutton, option).ToString( ).ToLower( );
                if (result == "cancel")
                {
                    rc = 2;
                }
            }
            Console.WriteLine(result);
            // Change return code if /R switch was used
            if (rcbutton)
            {
                if (rc == 1)
                {
                    return(-1);                    // error
                }
                switch (result)
                {
                case "abort":
                    return(1);                            // button 1 of AbortRetryIgnore

                case "cancel":
                    switch (buttons)
                    {
                    case MessageBoxButtons.OKCancel:
                    case MessageBoxButtons.RetryCancel:
                        return(2);                                        // button 2 for OKCancel or RetryCancel

                    case MessageBoxButtons.YesNoCancel:
                        return(3);                                        // button 3 for YesNoCancel

                    default:
                        return(0);                                        // terminated without clicking a button
                    }

                case "ignore":
                    return(3);                            // button 3 for AbortRetryIgnore

                case "no":
                    return(2);                            // button 2 for YesNo or YesNoCancel

                case "ok":
                    return(1);                            // button 1 for OK or OKCancel

                case "retry":
                    if (buttons == MessageBoxButtons.AbortRetryIgnore)
                    {
                        return(2);                                // button 2 for AbortRetryIgnore
                    }
                    else
                    {
                        return(1);                                // button 1 for RetryCancel
                    }

                case "timeout":
                    return(4);

                case "yes":
                    return(1);                            // button 1 for YesNo or YesNoCancel

                default:
                    return(-1);                            // error
                }
            }
            else
            {
                return(rc);
            }
        }
 protected void MessageBox_Show(Action <MessageBoxResult> resultAction, string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, MessageBoxOptions options = MessageBoxOptions.None)
 {
     if (this.MessageBoxRequest != null)
     {
         this.MessageBoxRequest(this, new MvvmMessageBoxEventArgs(resultAction, messageBoxText, caption, button, icon, defaultResult, options));
     }
 }
	// Methods
	public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton) {}
Пример #54
0
            AutoClosingMessageBox(string message, string title, int timeout, MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxDefaultButton defaultbutton = MessageBoxDefaultButton.Button1, MessageBoxOptions option = MessageBoxOptions.DefaultDesktopOnly)
            {
                _caption      = title;
                _timeouttimer = new System.Threading.Timer(OnTimerElapsed, null, timeout, System.Threading.Timeout.Infinite);

                using ( _timeouttimer )
                {
                    _result = System.Windows.Forms.MessageBox.Show(message, title, buttons, icon, defaultbutton, option | MessageBoxOptions.ServiceNotification);
                }
            }
	public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator) {}
Пример #56
0
 public static DialogResult Show(string message, string title, int timeout, MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxDefaultButton defaultbutton = MessageBoxDefaultButton.Button1, MessageBoxOptions option = MessageBoxOptions.DefaultDesktopOnly)
 {
     return(new AutoClosingMessageBox(message, title, timeout, buttons, icon, defaultbutton, option | MessageBoxOptions.ServiceNotification)._result);
 }
			public MessageBoxForm (IWin32Window owner, string text, string caption,
					MessageBoxButtons buttons, MessageBoxIcon icon,
					MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)
				: this (owner, text, caption, buttons, icon, displayHelpButton)
			{
				msgbox_default = defaultButton;
			}
Пример #58
0
 public MessageBoxResult ShowMessageBox(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
 {
     return(MessageBox.Show(messageBoxText, caption, button, icon, defaultResult, options));
 }
 public MyMessageBox WithOptions(MessageBoxOptions options)
 {
     this._Options = options;
     return this;
 }
Пример #60
0
        public MessageBoxViewModel(
            string text, string caption, MessageBoxButtons buttons,
            Drawing contentIcon,
            MessageBoxDefaultButton defaultButton,
            MessageBoxOptions options)
        {
            Title           = caption;
            StartupLocation = options.StartupLocation;

            ContentHeader  = options.HeaderText;
            ContentMessage = text;
            ContentIcon    = contentIcon;

            Buttons = new ObservableCollection <MessageBoxButton>();
            switch (buttons)
            {
            case MessageBoxButtons.OK:
                Buttons.Add(new MessageBoxButton(DialogResult.OK)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                break;

            case MessageBoxButtons.OKCancel:
                Buttons.Add(new MessageBoxButton(DialogResult.OK)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.Cancel)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                break;

            case MessageBoxButtons.AbortRetryIgnore:
                Buttons.Add(new MessageBoxButton(DialogResult.Abort)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.Retry)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.Ignore)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button3,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button3)
                });
                break;

            case MessageBoxButtons.YesNoCancel:
                Buttons.Add(new MessageBoxButton(DialogResult.Yes)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.No)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.Cancel)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button3,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button3)
                });
                break;

            case MessageBoxButtons.YesNo:
                Buttons.Add(new MessageBoxButton(DialogResult.Yes)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.No)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                break;

            case MessageBoxButtons.RetryCancel:
                Buttons.Add(new MessageBoxButton(DialogResult.Retry)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(DialogResult.Cancel)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                break;

            case MessageBoxButtons.Custom1:
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(0), DialogResult.Custom1)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                break;

            case MessageBoxButtons.Custom1Custom2:
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(0), DialogResult.Custom1)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(1), DialogResult.Custom2)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                break;

            case MessageBoxButtons.Custom1Custom2Custom3:
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(0), DialogResult.Custom1)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button1,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button1)
                });
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(1), DialogResult.Custom2)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button2,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button2)
                });
                Buttons.Add(new MessageBoxButton(options.ButtonTexts?.ElementAtOrDefault(2), DialogResult.Custom3)
                {
                    IsDefault = defaultButton == MessageBoxDefaultButton.Button3,
                    HasAccent = options.AccentButtons.HasFlag(MessageBoxAccentButtons.Button3)
                });
                break;
            }

            ButtonClick = ReactiveCommand.Create <Button, Unit>(sender =>
            {
                MessageBoxButton button = (MessageBoxButton)sender.DataContext;
                Result = button.Result;
                return(Unit.Default);
            });
        }