Class Msg
Provides easier access to typical MessageBox configurations and automatically upgrades to TaskDialogs when available.
Namespace: NanoByte.Common.Controls
Assembly: NanoByte.Common.WinForms.dll
Syntax
public static class Msg : Object
Methods
Inform(IWin32Window, String, MsgSeverity)
Displays a message to the user using a message box or task dialog.
Declaration
public static void Inform(IWin32Window owner, string text, MsgSeverity severity)
Parameters
Type | Name | Description |
---|---|---|
IWin32Window | owner | The parent window the displayed window is modal to; can be |
String | text | The message to be displayed. |
MsgSeverity | severity | How 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.
Declaration
public static bool OkCancel(IWin32Window owner, string text, MsgSeverity severity, string okCaption = null, string cancelCaption = null)
Parameters
Type | Name | Description |
---|---|---|
IWin32Window | owner | The parent window the displayed window is modal to; can be |
String | text | The message to be displayed. |
MsgSeverity | severity | How severe/important the message is. |
String | okCaption | The title and a short description (separated by a linebreak) of the OK option; |
String | cancelCaption | The title and a short description (separated by a linebreak) of the Cancel option; |
Returns
Type | Description |
---|---|
Boolean |
|
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.
Declaration
public static bool YesNo(IWin32Window owner, string text, MsgSeverity severity, string yesCaption = null, string noCaption = null)
Parameters
Type | Name | Description |
---|---|---|
IWin32Window | owner | The parent window the displayed window is modal to; can be |
String | text | The message to be displayed. |
MsgSeverity | severity | How severe/important the message is. |
String | yesCaption | The title and a short description (separated by a linebreak) of the Yes option; |
String | noCaption | The title and a short description (separated by a linebreak) of the No option; |
Returns
Type | Description |
---|---|
Boolean |
|
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.
Declaration
public static DialogResult YesNoCancel(IWin32Window owner, string text, MsgSeverity severity, string yesCaption = null, string noCaption = null)
Parameters
Type | Name | Description |
---|---|---|
IWin32Window | owner | The parent window the displayed window is modal to; can be |
String | text | The message to be displayed. |
MsgSeverity | severity | How severe/important the message is. |
String | yesCaption | The title and a short description (separated by a linebreak) of the Yes option; |
String | noCaption | The title and a short description (separated by a linebreak) of the No option; |
Returns
Type | Description |
---|---|
DialogResult | Yes if |
Remarks
If a MessageBox is used, yesCaption
and noCaption
are not display to the user, so don't rely on them!