NanoByte.Common
Static Public Member Functions | List of all members
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 ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity)
 Displays a message to the user using a MessageBox or TaskDialog. More...
 
static bool OkCancel ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity, [NotNull, Localizable(true)] string okCaption, [CanBeNull, Localizable(true)] string cancelCaption=null)
 Asks the user a OK/Cancel-question using a MessageBox or TaskDialog. More...
 
static bool OkCancel ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity)
 Asks the user a OK/Cancel-question using a MessageBox or TaskDialog. More...
 
static bool YesNo ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity, [NotNull, Localizable(true)] string yesCaption, [NotNull, Localizable(true)] string noCaption)
 Asks the user to choose between two options (yes/no) using a MessageBox or TaskDialog. More...
 
static bool YesNo ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity)
 Asks the user to choose between two options (yes/no) using a MessageBox or TaskDialog. More...
 
static DialogResult YesNoCancel ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity, [NotNull, Localizable(true)] string yesCaption, [NotNull, Localizable(true)] string noCaption)
 Asks the user to choose between three options (yes/no/cancel) using a MessageBox or TaskDialog. More...
 
static DialogResult YesNoCancel ([CanBeNull] IWin32Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity)
 Asks the user to choose between three options (yes/no/cancel) using a MessageBox or TaskDialog. 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 ( [CanBeNull] IWin32Window  owner,
[NotNull, Localizable(true)] string  text,
MsgSeverity  severity 
)
inlinestatic

Displays a message to the user using a MessageBox or TaskDialog.

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 ( [CanBeNull] IWin32Window  owner,
[NotNull, Localizable(true)] string  text,
MsgSeverity  severity,
[NotNull, Localizable(true)] string  okCaption,
[CanBeNull, Localizable(true)] string  cancelCaption = null 
)
inlinestatic

Asks the user a OK/Cancel-question using a MessageBox or TaskDialog.

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!

◆ OkCancel() [2/2]

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

Asks the user a OK/Cancel-question using a MessageBox or TaskDialog.

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!

◆ YesNo() [1/2]

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

Asks the user to choose between two options (yes/no) using a MessageBox or TaskDialog.

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!

◆ YesNo() [2/2]

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

Asks the user to choose between two options (yes/no) using a MessageBox or TaskDialog.

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

◆ YesNoCancel() [1/2]

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

Asks the user to choose between three options (yes/no/cancel) using a MessageBox or TaskDialog.

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!

◆ YesNoCancel() [2/2]

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

Asks the user to choose between three options (yes/no/cancel) using a MessageBox or TaskDialog.

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.

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