Class Msg
Provides easier access to typical MessageBox configurations and automatically upgrades to TaskDialogs when available.
public static class Msg
- Inheritance
-
Msg
Methods
Inform(IWin32Window?, string, MsgSeverity)
Displays a message to the user using a message box or task dialog.
public static void Inform(IWin32Window? owner, string text, MsgSeverity severity)
Parameters
owner
IWin32WindowThe parent window the displayed window is modal to; can be
null
.text
stringThe message to be displayed.
severity
MsgSeverityHow severe/important the message is.
OkCancel(IWin32Window?, string, MsgSeverity, string?, string?)
Asks the user a OK/Cancel-question using a message box or task dialog.
public static bool OkCancel(IWin32Window? owner, string text, MsgSeverity severity, string? okCaption = null, string? cancelCaption = null)
Parameters
owner
IWin32WindowThe parent window the displayed window is modal to; can be
null
.text
stringThe message to be displayed.
severity
MsgSeverityHow severe/important the message is.
okCaption
stringThe title and a short description (separated by a linebreak) of the OK option;
null
for default.cancelCaption
stringThe title and a short description (separated by a linebreak) of the Cancel option;
null
for default.
Returns
- bool
true
ifokCaption
was selected,false
ifcancelCaption
was selected.
Remarks
If a MessageBox is used, okCaption
and cancelCaption
are not display to the user, so don't rely on them!
YesNo(IWin32Window?, string, MsgSeverity, string?, string?)
Asks the user to choose between two options (yes/no) using a message box or task dialog.
public static bool YesNo(IWin32Window? owner, string text, MsgSeverity severity, string? yesCaption = null, string? noCaption = null)
Parameters
owner
IWin32WindowThe parent window the displayed window is modal to; can be
null
.text
stringThe message to be displayed.
severity
MsgSeverityHow severe/important the message is.
yesCaption
stringThe title and a short description (separated by a linebreak) of the Yes option;
null
for default.noCaption
stringThe title and a short description (separated by a linebreak) of the No option;
null
for default.
Returns
- bool
true
ifyesCaption
was chosen,false
ifnoCaption
was chosen.
Remarks
If a MessageBox is used, yesCaption
and noCaption
are not display to the user, so don't rely on them!
YesNoCancel(IWin32Window?, string, MsgSeverity, string?, string?)
Asks the user to choose between three options (yes/no/cancel) using a message box or task dialog.
public static DialogResult YesNoCancel(IWin32Window? owner, string text, MsgSeverity severity, string? yesCaption = null, string? noCaption = null)
Parameters
owner
IWin32WindowThe parent window the displayed window is modal to; can be
null
.text
stringThe message to be displayed.
severity
MsgSeverityHow severe/important the message is.
yesCaption
stringThe title and a short description (separated by a linebreak) of the Yes option;
null
for default.noCaption
stringThe title and a short description (separated by a linebreak) of the No option;
null
for default.
Returns
- DialogResult
Yes if
yesCaption
was chosen, No ifnoCaption
was chosen, Cancel otherwise.
Remarks
If a MessageBox is used, yesCaption
and noCaption
are not display to the user, so don't rely on them!