Click or drag to resize

WPFMessageBoxWrapper Class

Show a WPF window as a message box which is full configurable.
Inheritance Hierarchy
SystemObject
  SniffCore.MessageBoxesWPFMessageBoxWrapper

Namespace:  SniffCore.MessageBoxes
Assembly:  SniffCore.MessageBoxes (in SniffCore.MessageBoxes.dll) Version: 1.0.0
Syntax
C#
public class WPFMessageBoxWrapper : IWPFMessageBoxWrapper

The WPFMessageBoxWrapper type exposes the following members.

Constructors
  NameDescription
Public methodWPFMessageBoxWrapper
Initializes a new instance of the WPFMessageBoxWrapper class
Top
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodShow(String)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons, WPFMessageBoxImages)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxResult)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons, WPFMessageBoxImages)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxResult, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxResult)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodShow(Window, String, String, WPFMessageBoxButtons, WPFMessageBoxImages, WPFMessageBoxResult, WPFMessageBoxOptions)
Displays a message box that has a message and that returns a result of the button the user pressed.
Public methodToString (Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodIsNullOrEmpty
Checks if the object is null or an empty string.
(Defined by ObjectEx.)
Public Extension MethodIsNullOrWhiteSpace
Checks if the object is null, an empty string or a string which consists of whitespace (or tabs) only.
(Defined by ObjectEx.)
Top
Examples
C#
public class ViewModel : ObservableObject
{
    private IWPFMessageBoxWrapper _messageBox
    public ViewModel(IWPFMessageBoxWrapper messageBox)
    {
        _messageBox = messageBox;
    }

    public void Show()
    {
        messageBox.Show("Messagebox Text");
    }
}

[TestFixture]
public class ViewModelTests
{
    private Mock<IWPFMessageBoxWrapper> _messageBox;
    private ViewModel _target;

    [SetUp]
    public void Setup()
    {
        _messageBox = new Mock<IWPFMessageBoxWrapper>();
        _target = new ViewModel(_messageBox.Object);
    }

    [Test]
    public void Show_Called_ShowsMessageBox()
    {
        _target.Show();

        _messageBox.Verify(x => x.Show("Messagebox Text"), Times.Once);
    }
}
See Also