Raine.MessageBox 1.0.0-preview.2

This is a prerelease version of Raine.MessageBox.
dotnet add package Raine.MessageBox --version 1.0.0-preview.2                
NuGet\Install-Package Raine.MessageBox -Version 1.0.0-preview.2                
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="Raine.MessageBox" Version="1.0.0-preview.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Raine.MessageBox --version 1.0.0-preview.2                
#r "nuget: Raine.MessageBox, 1.0.0-preview.2"                
#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 Raine.MessageBox as a Cake Addin
#addin nuget:?package=Raine.MessageBox&version=1.0.0-preview.2&prerelease

// Install Raine.MessageBox as a Cake Tool
#tool nuget:?package=Raine.MessageBox&version=1.0.0-preview.2&prerelease                

Raine.MessageBox

A fluent interface for the System.Windows.Forms.MessageBox class.

NuGet Version NuGet Downloads

Installation

You can install this package via the Package Manager Console in Visual Studio.

Install-Package Raine.MessageBox -PreRelease

[!NOTE] This package requires .NET Framework 4.8 or .NET 6.0+

Usage

The following example shows how to build a simple message box.

// using Raine.MessageBox;

DialogResult result = new MessageBoxBuilder()
    .WithText("Would you like to exit?")
    .WithCaption("Are you sure?")
    .WithButtons(MessageBoxButtons.YesNo)
    .WithIcon(MessageBoxIcon.Question)
    .Show();

You can do the same in Visual Basic.

' Imports Raine.MessageBox

Dim Result As DialogResult = New MessageBoxBuilder().
    WithText("Would you like to exit?").
    WithCaption("Are you sure?").
    WithButtons(MessageBoxButtons.YesNo).
    WithIcon(MessageBoxIcon.Question).
    Show()

Since we're using a StringBuilder, we have a WithAppendLine method.

// using Raine.MessageBox;

DialogResult result = new MessageBoxBuilder()
    .WithAppendLine("Would you like to exit?")
    .WithAppendLine("Any unsaved progress will be lost.")
    .WithAppendLine("Please save your work before continue.")
    .WithCaption("Are you sure?")
    .WithButtons(MessageBoxButtons.YesNo)
    .WithIcon(MessageBoxIcon.Question)
    .Show();

You can also have access to the other message box options.

// using Raine.MessageBox;

DialogResult result = new MessageBoxBuilder()
    .WithAppendLine("Would you like to exit?")
    .WithAppendLine("Any unsaved progress will be lost.")
    .WithAppendLine("Please save your work before continue.")
    .WithCaption("Are you sure?")
    .WithButtons(MessageBoxButtons.YesNo)
    .WithIcon(MessageBoxIcon.Question)
    .WithDefaultButton(MessageBoxDefaultButton.Button2)
    .WithOptions(MessageBoxOptions.RightAlign)
    .Show();

License

This project 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 net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

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

    • 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 Downloads Last updated
1.0.0-preview.2 60 10/9/2024
1.0.0-preview.1 183 6/7/2021