AutoClosingMessageBox 1.0.0.2

MessageBox with auto-closing functionality

Install-Package AutoClosingMessageBox -Version 1.0.0.2
dotnet add package AutoClosingMessageBox --version 1.0.0.2
<PackageReference Include="AutoClosingMessageBox" Version="1.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutoClosingMessageBox --version 1.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Usage:

Use the AutoClosingMessageBox.Show method either as follows:

// Fire and forget - it about to be closed after default timeout(1000ms)
AutoClosingMessageBox.Show("Hello, World!");

or follows:

// Wait for some result or make the default decision
var result = AutoClosingMessageBox.Show(
            text: "To be or not to be?", 
            caption: "The question",
            timeout: 2500,
            buttons: MessageBoxButtons.YesNo,
            defaultResult: DialogResult.Yes);
if(result == DialogResult.Yes) {
    // to be
}
else { 
    // or not
}

You can also use the AutoClosingMessageBox.Factory to get full control on MessageBox showing:

var toBeOrNotToBeQuestion = AutoClosingMessageBox.Factory(
        showMethod: (caption, buttons) =>
            MessageBox.Show(this, "To be or not to be?", caption, buttons, MessageBoxIcon.Question),
        caption: "The question"
    );
if(DialogResult.Yes == toBeOrNotToBeQuestion.Show(
                            timeout: 2500,
                            buttons: MessageBoxButtons.YesNo,
                            defaultResult: DialogResult.Yes)) {
    // to be
}
else {
    // or not
}

Usage:

Use the AutoClosingMessageBox.Show method either as follows:

// Fire and forget - it about to be closed after default timeout(1000ms)
AutoClosingMessageBox.Show("Hello, World!");

or follows:

// Wait for some result or make the default decision
var result = AutoClosingMessageBox.Show(
            text: "To be or not to be?", 
            caption: "The question",
            timeout: 2500,
            buttons: MessageBoxButtons.YesNo,
            defaultResult: DialogResult.Yes);
if(result == DialogResult.Yes) {
    // to be
}
else { 
    // or not
}

You can also use the AutoClosingMessageBox.Factory to get full control on MessageBox showing:

var toBeOrNotToBeQuestion = AutoClosingMessageBox.Factory(
        showMethod: (caption, buttons) =>
            MessageBox.Show(this, "To be or not to be?", caption, buttons, MessageBoxIcon.Question),
        caption: "The question"
    );
if(DialogResult.Yes == toBeOrNotToBeQuestion.Show(
                            timeout: 2500,
                            buttons: MessageBoxButtons.YesNo,
                            defaultResult: DialogResult.Yes)) {
    // to be
}
else {
    // or not
}

Release Notes

The MessageBox which automatically closes after the specific timeout.

v1.0.0.2:
- New Show(IWin32Owner) API to support most popular scenarios (in the
context of #1 );
- New Factory() API to provide full control on MessageBox showing;

Dependencies

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0.2 14,133 11/3/2017