/// <summary> /// Displays a customized message box in front of the specified window. /// </summary> /// <param name="owner">Owner window of the message box.</param> /// <param name="messageBoxTextComposition">Text composition to display.</param> /// <param name="caption">Title bar caption to display.</param> /// <param name="button">A value that specifies which button or buttons to display.</param> /// <param name="icon">Icon to display.</param> /// <param name="checkBoxText">Response check box caption.</param> /// <param name="checkBoxState">Response check box default\return state.</param> /// <returns>Button value which message box is clicked by the user.</returns> private MessageBoxExButtonType _Show(Window owner, IList <Inline> messageBoxTextComposition, string caption, MessageBoxButtons button, MessageBoxImage icon, string checkBoxText, ref bool checkBoxState) { // initialize components of message box _msgBox = new MessageBoxExDlg(); _msgBox.Caption = caption; _msgBox.StandardIcon = icon; _msgBox._textBlockQuestion.Inlines.Clear(); foreach (Inline inline in messageBoxTextComposition) { _msgBox._textBlockQuestion.Inlines.Add(inline); } if (string.IsNullOrEmpty(checkBoxText)) { _msgBox.ResponseText = null; } else { _msgBox.ResponseText = checkBoxText; _msgBox.Response = checkBoxState; } _AddButtons(button); if (null != owner) { _msgBox.Owner = owner; } using (MouseHelper.OverrideCursor(null)) { // populate dialog _msgBox.ShowDialog(); // NOTE: ignore result } // get results if (!string.IsNullOrEmpty(checkBoxText)) { checkBoxState = _msgBox.Response; } return(_msgBox.Result); }
/// <summary> /// Displays a customized message box in front of the specified window. /// </summary> /// <param name="owner">Owner window of the message box.</param> /// <param name="messageBoxTextComposition">Text composition to display.</param> /// <param name="caption">Title bar caption to display.</param> /// <param name="button">A value that specifies which button or buttons to display.</param> /// <param name="icon">Icon to display.</param> /// <param name="checkBoxText">Response check box caption.</param> /// <param name="checkBoxState">Response check box default\return state.</param> /// <returns>Button value which message box is clicked by the user.</returns> private MessageBoxExButtonType _Show(Window owner, IList<Inline> messageBoxTextComposition, string caption, MessageBoxButtons button, MessageBoxImage icon, string checkBoxText, ref bool checkBoxState) { // initialize components of message box _msgBox = new MessageBoxExDlg(); _msgBox.Caption = caption; _msgBox.StandardIcon = icon; _msgBox._textBlockQuestion.Inlines.Clear(); foreach (Inline inline in messageBoxTextComposition) _msgBox._textBlockQuestion.Inlines.Add(inline); if (string.IsNullOrEmpty(checkBoxText)) _msgBox.ResponseText = null; else { _msgBox.ResponseText = checkBoxText; _msgBox.Response = checkBoxState; } _AddButtons(button); if (null != owner) _msgBox.Owner = owner; using (MouseHelper.OverrideCursor(null)) { // populate dialog _msgBox.ShowDialog(); // NOTE: ignore result } // get results if (!string.IsNullOrEmpty(checkBoxText)) checkBoxState = _msgBox.Response; return _msgBox.Result; }