/// <summary> /// Shows the dialog with icon/caption/buttons. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <param name="defaultResult">The default result.</param> public virtual MessageBoxResult ShowDialogModal(DialogControlContainer owner, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) { _title = caption; _button = button; _icon = icon; _defResult = defaultResult; ApplyOptions(); ShowDialogModal(owner); return(_result); }
/// <summary> /// Shows the dialog on a <see cref="DialogControlContainer"/>. /// </summary> /// <param name="container">The container.</param> /// <exception cref="System.ArgumentNullException">container</exception> public virtual void ShowDialog(DialogControlContainer container) { if (container == null) { throw new ArgumentNullException("container"); } container.Show(this); _isOpen = true; _diaglogResult = null; }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <param name="defaultResult">The default result.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) { if (owner == null) { throw new ArgumentNullException("owner"); } var diag = new ModernMessageBox(); diag.txtMsg.Text = messageBoxText; return(diag.ShowDialogModal(owner, caption, button, icon, defaultResult)); }
/// <summary> /// Shows the dialog on a <see cref="DialogControlContainer"/>. /// </summary> /// <param name="container">The container.</param> /// <exception cref="System.ArgumentNullException">container</exception> public virtual bool?ShowDialogModal(DialogControlContainer container) { ShowDialog(container); while (_isOpen) { // from http://www.codeproject.com/Articles/36516/WPF-Modal-Dialog // HACK: Stop the thread if the application is about to close if (this.Dispatcher.HasShutdownStarted || this.Dispatcher.HasShutdownFinished) { break; } // HACK: Simulate "DoEvents" //this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { })); this.Dispatcher.DoEvents(); Thread.Sleep(20); } return(DialogResult); }
/// <summary> /// Shows the dialog with icon/caption/buttons. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <param name="defaultResult">The default result.</param> public virtual MessageBoxResult ShowDialogModal(DialogControlContainer owner, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) { _title = caption; _button = button; _icon = icon; _defResult = defaultResult; ApplyOptions(); ShowDialogModal(owner); return _result; }
/// <summary> /// Shows the dialog on a <see cref="DialogControlContainer"/>. /// </summary> /// <param name="container">The container.</param> /// <exception cref="System.ArgumentNullException">container</exception> public virtual bool? ShowDialogModal(DialogControlContainer container) { ShowDialog(container); while (_isOpen) { // from http://www.codeproject.com/Articles/36516/WPF-Modal-Dialog // HACK: Stop the thread if the application is about to close if (this.Dispatcher.HasShutdownStarted || this.Dispatcher.HasShutdownFinished) { break; } // HACK: Simulate "DoEvents" //this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { })); this.Dispatcher.DoEvents(); Thread.Sleep(20); } return DialogResult; }
/// <summary> /// Shows the dialog on a <see cref="DialogControlContainer"/>. /// </summary> /// <param name="container">The container.</param> /// <exception cref="System.ArgumentNullException">container</exception> public virtual void ShowDialog(DialogControlContainer container) { if (container == null) { throw new ArgumentNullException("container"); } container.Show(this); _isOpen = true; _diaglogResult = null; }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon) { return(Show(owner, messageBoxText, caption, button, icon, MessageBoxResult.None)); }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText) { return(Show(owner, messageBoxText, null, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.None)); }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <param name="defaultResult">The default result.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult) { if (owner == null) { throw new ArgumentNullException("owner"); } var diag = new ModernMessageBox(); diag.txtMsg.Text = messageBoxText; return diag.ShowDialogModal(owner, caption, button, icon, defaultResult); }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button to display.</param> /// <param name="icon">The icon to display.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon) { return Show(owner, messageBoxText, caption, button, icon, MessageBoxResult.None); }
/// <summary> /// Displays a message box in front of the specified <see cref="DialogControlContainer" />. /// </summary> /// <param name="owner">A <see cref="DialogControlContainer" /> to host this message box.</param> /// <param name="messageBoxText">The message box text.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">owner</exception> public static MessageBoxResult Show(DialogControlContainer owner, string messageBoxText) { return Show(owner, messageBoxText, null, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.None); }