NanoByte.Common  2.7.0
NanoByte.Common.Msg Class Reference

Provides easier access to typical MessageBox configurations and automatically upgrades to TaskDialogs when available. More...

Static Public Member Functions

static void Inform (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity)
 Displays a message to the user using a message box or task dialog. More...
 
static bool OkCancel (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity, [Localizable(true)] string okCaption, [Localizable(true)] string? cancelCaption=null)
 Asks the user a OK/Cancel-question using a message box or task dialog. More...
 
static bool OkCancel (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity)
 Asks the user a OK/Cancel-question using a message box or task dialog. More...
 
static bool YesNo (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity, [Localizable(true)] string yesCaption, [Localizable(true)] string noCaption)
 Asks the user to choose between two options (yes/no) using a message box or task dialog. More...
 
static bool YesNo (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity)
 Asks the user to choose between two options (yes/no) using a message box or task dialog. More...
 
static DialogResult YesNoCancel (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity, [Localizable(true)] string yesCaption, [Localizable(true)] string noCaption)
 Asks the user to choose between three options (yes/no/cancel) using a message box or task dialog. More...
 
static DialogResult YesNoCancel (IWin32Window? owner, [Localizable(true)] string text, MsgSeverity severity)
 Asks the user to choose between three options (yes/no/cancel) using a message box or task dialog. More...
 

Detailed Description

Provides easier access to typical MessageBox configurations and automatically upgrades to TaskDialogs when available.

Member Function Documentation

◆ Inform()

static void NanoByte.Common.Msg.Inform ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity 
)
inlinestatic

Displays a message to the user using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.

◆ OkCancel() [1/2]

static bool NanoByte.Common.Msg.OkCancel ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity 
)
static

Asks the user a OK/Cancel-question using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.
Returns
true if OK was selected, false if Cancel was selected.

If a MessageBox is used, OK and Cancel are not display to the user, so don't rely on them!

◆ OkCancel() [2/2]

static bool NanoByte.Common.Msg.OkCancel ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity,
[Localizable(true)] string  okCaption,
[Localizable(true)] string?  cancelCaption = null 
)
inlinestatic

Asks the user a OK/Cancel-question using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.
okCaptionThe title and a short description (separated by a linebreak) of the DialogResult.OK option.
cancelCaptionThe title and a short description (separated by a linebreak) of the DialogResult.Cancel option; can be null.
Returns
true if okCaption was selected, false if cancelCaption was selected.

If a MessageBox is used, okCaption and cancelCaption are not display to the user, so don't rely on them!

◆ YesNo() [1/2]

static bool NanoByte.Common.Msg.YesNo ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity 
)
static

Asks the user to choose between two options (yes/no) using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.

◆ YesNo() [2/2]

static bool NanoByte.Common.Msg.YesNo ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity,
[Localizable(true)] string  yesCaption,
[Localizable(true)] string  noCaption 
)
inlinestatic

Asks the user to choose between two options (yes/no) using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.
yesCaptionThe title and a short description (separated by a linebreak) of the DialogResult.Yes option.
noCaptionThe title and a short description (separated by a linebreak) of the DialogResult.No option.
Returns
true if yesCaption was chosen, false if noCaption was chosen.

If a MessageBox is used, yesCaption and noCaption are not display to the user, so don't rely on them!

◆ YesNoCancel() [1/2]

static DialogResult NanoByte.Common.Msg.YesNoCancel ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity 
)
static

Asks the user to choose between three options (yes/no/cancel) using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.
Returns
DialogResult.Yes if Yes was chosen, DialogResult.No if No was chosen, DialogResult.Cancel otherwise.

◆ YesNoCancel() [2/2]

static DialogResult NanoByte.Common.Msg.YesNoCancel ( IWin32Window?  owner,
[Localizable(true)] string  text,
MsgSeverity  severity,
[Localizable(true)] string  yesCaption,
[Localizable(true)] string  noCaption 
)
inlinestatic

Asks the user to choose between three options (yes/no/cancel) using a message box or task dialog.

Parameters
ownerThe parent window the displayed window is modal to; can be null.
textThe message to be displayed.
severityHow severe/important the message is.
yesCaptionThe title and a short description (separated by a linebreak) of the DialogResult.Yes option.
noCaptionThe title and a short description (separated by a linebreak) of the DialogResult.No option.
Returns
DialogResult.Yes if yesCaption was chosen, DialogResult.No if noCaption was chosen, DialogResult.Cancel otherwise.

If a MessageBox is used, yesCaption and noCaption are not display to the user, so don't rely on them!


The documentation for this class was generated from the following file: