In This Article

UserPromptService Class

Defines an implementation of IUserPromptService.

public class UserPromptService : IUserPromptService, IDesignerSafeUserPromptService
Inheritance:
object object
Implements:
IUserPromptService IDesignerSafeUserPromptService

Remarks

For internal use only.

Constructors

UserPromptService()

Initializes a new instance of the UserPromptService class.

protected UserPromptService()

Remarks

For internal use only.

Properties

Default

A default instance of the IUserPromptService.

public static IUserPromptService Default { get; }

Property Value

IUserPromptService

Remarks

For internal use only.

DefaultErrorCaption

The default caption to use for error messages.

protected static string DefaultErrorCaption { get; }

Property Value

string

Remarks

For internal use only.

DefaultMessageCaption

The default caption to use for general messages.

protected static string DefaultMessageCaption { get; }

Property Value

string

Remarks

For internal use only.

DefaultWarningCaption

The default caption to use for warning messages.

protected static string DefaultWarningCaption { get; }

Property Value

string

Remarks

For internal use only.

Methods

CreateOpenFileResult(DialogResult, IOpenFileOptions)

Creates a new instance of an implementation for IOpenFileResult.

protected static IOpenFileResult CreateOpenFileResult(DialogResult dialogResult, IOpenFileOptions options)
Parameter Type Description
dialogResult DialogResult

One of the DialogResult values indicating the result code of the user's interaction.

options IOpenFileOptions

The options representing the state of the dialog after the user's interaction including any selected file(s).

Returns

IOpenFileResult

Remarks

For internal use only.

CreateSaveFileResult(DialogResult, ISaveFileOptions)

Creates a new instance of an implementation for ISaveFileResult.

protected static ISaveFileResult CreateSaveFileResult(DialogResult dialogResult, ISaveFileOptions options)
Parameter Type Description
dialogResult DialogResult

One of the DialogResult values indicating the result code of the user's interaction.

options ISaveFileOptions

The options representing the state of the dialog after the user's interaction including any selected file(s).

Returns

ISaveFileResult

Remarks

For internal use only.

GetDialogOwnerWindow()

Gets the owner window, if any, that should be used for dialogs.

protected IWin32Window GetDialogOwnerWindow()

Returns

IWin32Window:

The owner window if available; otherwise null.

Remarks

For internal use only.

ShowDialog(Form)

Displays the specified form in a dialog box.

protected virtual DialogResult ShowDialog(Form form)
Parameter Type Description
form Form

The form to display.

Returns

DialogResult:

One of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowDialogAsync(Form)

Displays the specified form in a modal dialog box.

protected virtual Task<DialogResult> ShowDialogAsync(Form form)
Parameter Type Description
form Form

The form to display.

Returns

Task<DialogResult>:

A task which completes when the modal dialog is closed and whose result will be one of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowError(Exception, string)

Displays the specified exception and information about the exception, typically in a message box.

protected virtual void ShowError(Exception ex, string message = null)
Parameter Type Description
ex Exception

The Exception to display.

message string

Optionally defines a message to display that provides information about the exception.

Remarks

For internal use only.

ShowError(string, string)

Displays the specified error message, typically in a message box.

protected virtual void ShowError(string message, string caption = null)
Parameter Type Description
message string

The error message to display.

caption string

Optionally defines the caption of the message.

Remarks

For internal use only.

ShowFileOpen(IOpenFileOptions)

Displays a dialog prompting the user to open a file.

protected virtual IOpenFileResult ShowFileOpen(IOpenFileOptions options)
Parameter Type Description
options IOpenFileOptions

The model defining the characteristics and behavior of the file prompt.

Returns

IOpenFileResult:

The result of the user interaction.

Remarks

For internal use only.

ShowFileOpenAsync(IOpenFileOptions)

Displays a dialog prompting the user to open a file.

protected virtual Task<IOpenFileResult> ShowFileOpenAsync(IOpenFileOptions options)
Parameter Type Description
options IOpenFileOptions

The options defining the characteristics of the file prompt.

Returns

Task<IOpenFileResult>:

A task which completes when the prompt is closed and whose result will be one of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowFileOpenAsync(IOpenFileOptions, Action<IOpenFileResult>)

Displays a dialog prompting the user to open a file.

protected virtual void ShowFileOpenAsync(IOpenFileOptions options, Action<IOpenFileResult> handler)
Parameter Type Description
options IOpenFileOptions

The options defining the characteristics of the file prompt.

handler Action<IOpenFileResult>

The action that will be called to handle the response.

Remarks

For internal use only.

ShowFileSave(ISaveFileOptions)

Displays a dialog prompting the user to save a file.

protected virtual ISaveFileResult ShowFileSave(ISaveFileOptions options)
Parameter Type Description
options ISaveFileOptions

The model defining the characteristics and behavior of the file prompt.

Returns

ISaveFileResult:

The result of the user interaction.

Remarks

For internal use only.

ShowFileSaveAsync(ISaveFileOptions)

Displays a dialog prompting the user to save a file.

protected virtual Task<ISaveFileResult> ShowFileSaveAsync(ISaveFileOptions options)
Parameter Type Description
options ISaveFileOptions

The options defining the characteristics of the file prompt.

Returns

Task<ISaveFileResult>:

A task which completes when the prompt is closed and whose result will be one of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowFileSaveAsync(ISaveFileOptions, Action<ISaveFileResult>)

Displays a dialog prompting the user to save a file.

protected virtual void ShowFileSaveAsync(ISaveFileOptions options, Action<ISaveFileResult> handler)
Parameter Type Description
options ISaveFileOptions

The options defining the characteristics of the file prompt.

handler Action<ISaveFileResult>

The action that will be called to handle the response.

Remarks

For internal use only.

ShowMessage(string, string)

Displays the specified message, typically in a message box.

protected virtual void ShowMessage(string message, string caption = null)
Parameter Type Description
message string

The message to display.

caption string

Optionally defines the caption, typically for a message box.

Remarks

For internal use only.

ShowMessageBox(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)

Displays a message box with specified text, caption, buttons, and icon.

protected virtual DialogResult ShowMessageBox(IWin32Window owner, string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
Parameter Type Description
owner IWin32Window

The owner of the message box.

message string

The text to display in the message box.

caption string

The text to display in the title bar of the message box.

buttons MessageBoxButtons

One of the MessageBoxButtons values that specifies which buttons to display in the message box.

icon MessageBoxIcon

One of the MessageBoxIcon values that specifies which icon to display in the message box.

defaultButton MessageBoxDefaultButton

The default button for the message box.

Returns

DialogResult:

One of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowMessageBoxAsync(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)

Displays the specified message in a message box with the specified caption and buttons to place on the dialog box.

protected virtual Task<DialogResult> ShowMessageBoxAsync(string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
Parameter Type Description
message string

The message to display.

caption string

The caption for the dialog box.

buttons MessageBoxButtons

The buttons to be displayed.

icon MessageBoxIcon

The icon to be displayed.

defaultButton MessageBoxDefaultButton

The default button for the message box.

Returns

Task<DialogResult>:

A task which completes when the message is closed and whose result will be one of the DialogResult values indicating the result code of the user's interaction.

Remarks

For internal use only.

ShowMessageBoxAsync(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, Action<DialogResult>)

Displays the specified message in a message box with the specified caption and buttons to place on the dialog box.

protected virtual void ShowMessageBoxAsync(string message, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, Action<DialogResult> handler)
Parameter Type Description
message string

The message to display.

caption string

The caption for the dialog box.

buttons MessageBoxButtons

The buttons to be displayed.

icon MessageBoxIcon

The icon to be displayed.

defaultButton MessageBoxDefaultButton

The default button for the message box.

handler Action<DialogResult>

The action that will be called to handle the response.

Remarks

For internal use only.

ShowNonInteractiveMessageBox(string, string, MessageBoxIcon)

Displays a message box with specified text, caption, and icon where the response of the user is not required.

protected virtual void ShowNonInteractiveMessageBox(string message, string caption, MessageBoxIcon icon)
Parameter Type Description
message string

The text to display in the message box.

caption string

The text to display in the title bar of the message box.

icon MessageBoxIcon

One of the MessageBoxIcon values that specifies which icon to display in the message box.

Remarks

For internal use only.

ShowWarning(string, string)

Displays the specified warning message, typically in a message box.

protected virtual void ShowWarning(string message, string caption = null)
Parameter Type Description
message string

The message to display.

caption string

Optionally defines the caption, typically for a message box.

Remarks

For internal use only.

Inherited Members