Table of Contents

Class MessageBox

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

Static convenience helpers that build a small content tree and show it via Dialog<TResult> - a message with a button row (ShowAsync(Canvas, string, DialogButtons)), or a single-line text prompt (ShowInputAsync(Canvas, string, string?)). A separate, non-generic class rather than static members on Dialog<TResult> itself, to avoid declaring statics on a generic type (CA1000) while keeping Dialog<TResult>'s own API fully type-safe.

public static class MessageBox
Inheritance
MessageBox
Inherited Members

Methods

ShowAsync(Canvas, string, DialogButtons)

Shows a modal message with a row of buttons, and returns the DialogResult of whichever one the user pressed.

public static Task<DialogResult> ShowAsync(Canvas canvas, string message, DialogButtons buttons = DialogButtons.OK)

Parameters

canvas Canvas

The canvas to show the message box on.

message string

The message text to display.

buttons DialogButtons

Which buttons to show. Defaults to OK.

Returns

Task<DialogResult>

A task that completes with the pressed button's DialogResult.

ShowInputAsync(Canvas, string, string?)

Shows a modal single-line text prompt with OK/Cancel buttons.

public static Task<string?> ShowInputAsync(Canvas canvas, string prompt, string? defaultValue = null)

Parameters

canvas Canvas

The canvas to show the prompt on.

prompt string

The prompt text to display above the text box.

defaultValue string

The text box's initial value. Defaults to an empty string.

Returns

Task<string>

A task that completes with the text box's value when OK is pressed, or null when Cancel is pressed.