Skip to content

MessageWindow

Class in Oadm.Sdk.Client.Controls · Oadm.Sdk.Client.dll

The message and confirmation dialog of the host and of plugin dialogs (one window, never a copy): title bar, the message, and a DialogFooter with Cancel on the left and the primary confirm button on the right. Use MessageWindow.ConfirmAsync / MessageWindow.ShowMessageAsync; the window size follows the message. A confirm button that deletes or removes something (MessageWindow.IsDestructive) is the red Button.danger.

public sealed class MessageWindow : Window

Inherits Window

Guide: UI kit

Button CancelButton { get; }

The Cancel button (for tests).

string? CancelText { get; set; }

Text of the Cancel button; null or empty hides it (a plain message with OK only).

ComboBox ChoiceBox { get; }

The choice’s select (for tests).

string? ChoiceLabel { get; set; }

The label of one choice below the message (“Reason”); null hides it. The choices are MessageWindow.Choices, the chosen one MessageWindow.ChosenIndex (the first by default).

IReadOnlyList<string> Choices { get; set; }

The choices of MessageWindow.ChoiceLabel.

int ChosenIndex { get; set; }

The index of the chosen choice; -1 without choices.

Button ConfirmButton { get; }

The confirm button (for tests).

string? ConfirmText { get; set; }

The text of the confirm button; red when it starts with Delete, Remove or Release.

string? Heading { get; set; }

The window title (title bar and task switcher).

bool IsDanger { get; set; }

The confirm button is the red danger button (set from MessageWindow.ConfirmText; can be overridden).

string? Message { get; set; }

The message. Line breaks start a new line; text between ** is bold (“Turn on Compliance”).

static Task<bool> ConfirmAsync(Window owner, string title, string message, string confirmText, string cancelText = "Cancel")

Asks for confirmation; true when the user clicked confirmText.

static Task<int?> ConfirmWithChoiceAsync(Window owner, string title, string message, string confirmText, string choiceLabel, IReadOnlyList<string> choices, bool danger = false)

Asks for confirmation with one choice below the message (Revoke: the reason); the index of the chosen one when the user clicked confirmText, null for Cancel. danger: a red confirm button for an action that cannot be undone whatever its text.

static bool IsDestructive(string? confirmText)

True for confirm texts of irreversible actions: they start with Delete, Remove, Release or Format (“Delete all”, “Remove”, “Release”, “Format”: formatting deletes the recordings). One rule for the host and every plugin.

static Task ShowMessageAsync(Window owner, string title, string message)

Shows a message with an OK button.