Class Msg
Provides easier access to typical System.Windows.Forms.MessageBox configurations and automatically upgrades to TaskDialogs when available.
public static class Msg
- Inheritance
-
objectMsg
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
ownerIWin32WindowThe parent window the displayed window is modal to; can be
null.textstringThe message to be displayed.
severityMsgSeverityHow 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
ownerIWin32WindowThe parent window the displayed window is modal to; can be
null.textstringThe message to be displayed.
severityMsgSeverityHow severe/important the message is.
okCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.OK option;
nullfor default.cancelCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.Cancel option;
nullfor default.
Returns
- bool
trueifokCaptionwas selected,falseifcancelCaptionwas selected.
Remarks
If a System.Windows.Forms.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
ownerIWin32WindowThe parent window the displayed window is modal to; can be
null.textstringThe message to be displayed.
severityMsgSeverityHow severe/important the message is.
yesCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.Yes option;
nullfor default.noCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.No option;
nullfor default.
Returns
- bool
trueifyesCaptionwas chosen,falseifnoCaptionwas chosen.
Remarks
If a System.Windows.Forms.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
ownerIWin32WindowThe parent window the displayed window is modal to; can be
null.textstringThe message to be displayed.
severityMsgSeverityHow severe/important the message is.
yesCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.Yes option;
nullfor default.noCaptionstringThe title and a short description (separated by a linebreak) of the System.Windows.Forms.DialogResult.No option;
nullfor default.
Returns
- DialogResult
System.Windows.Forms.DialogResult.Yes if
yesCaptionwas chosen, System.Windows.Forms.DialogResult.No ifnoCaptionwas chosen, System.Windows.Forms.DialogResult.Cancel otherwise.
Remarks
If a System.Windows.Forms.MessageBox is used, yesCaption and noCaption are not display to the user, so don't rely on them!