AutoClosingMessageBox 1.0.0.5

dotnet add package AutoClosingMessageBox --version 1.0.0.5
NuGet\Install-Package AutoClosingMessageBox -Version 1.0.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutoClosingMessageBox" Version="1.0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutoClosingMessageBox --version 1.0.0.5
#r "nuget: AutoClosingMessageBox, 1.0.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AutoClosingMessageBox as a Cake Addin
#addin nuget:?package=AutoClosingMessageBox&version=1.0.0.5

// Install AutoClosingMessageBox as a Cake Tool
#tool nuget:?package=AutoClosingMessageBox&version=1.0.0.5

AutoClosingMessageBox

The MessageBox which automatically closes after the specific timeout.

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 method to get full control on MessageBox showing (for example, use icons):

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
}

Since v1.0.0.3 you can also use the CountDown feature:

AutoClosingMessageBox.Show("Hello, World!", timeout: 5000, showCountDown: true);

or in Factory-manner:

var messageBoxWithQuestionIcon = AutoClosingMessageBox.Factory(
        showMethod: (caption, buttons) =>
            MessageBox.Show(this, "To be or not to be?", caption, buttons, MessageBoxIcon.Question),
        caption: "The question",
        showCountDown: true // CountDown feature activation
    );
messageBoxWithQuestionIcon.Show();

NuGet

To install AutoClosingMessageBox, run the following command in the Package Manager Console:

Install-Package AutoClosingMessageBox

License

The AutoClosingMessageBox library is licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on AutoClosingMessageBox:

Package Downloads
NKit.Windows

.NET Toolkits (class libraries) containing reusable code for speeding up development of any .NET applications. NKit.Standard is the .NET Standard compatible version of NKit. NKit.Windows is the .NET Framework compatbile version of NKit. NKit.Core is the latest .NET Core compatible version of NKit.

NKit.Windows.Standalone

.NET Toolkits (class libraries) containing reusable code for speeding up development of any .NET applications. NKit.Standard is the .NET Standard compatible version of NKit.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.5 5,703 12/23/2022
1.0.0.2 44,560 11/3/2017

v1.0.0.5:
     - multitarget nuget package for .NET6/.Net 4.7.2