Skip to content

IConfirmDialogService.Show method (1 of 2)

Shows the dialog unless the user has already asked not to see it.

Namespace: Eremex.AvaloniaUI.Controls.ApplicationServices
Assembly: Eremex.Common.Contracts.dll
NuGet Package: Eremex.Common.Contracts

Declaration

public DialogResult Show(string key, IEnumerable<string> messages, string title, 
    string? header = null, MessageBoxIcon icon = MessageBoxIcon.None, 
    MessageBoxButtons buttons = MessageBoxButtons.OkCancel)

Parameters

name type description
key string Identifies the dialog. Dialogs with the same key are suppressed together, so use a distinct key for each message.
messages IEnumerable<string> The message lines shown in the body of the dialog.
title string The window caption.
header string? The emphasized line above the messages, or null.
icon MessageBoxIcon The icon shown next to the messages.
buttons MessageBoxButtons The set of buttons to offer in the footer.

Returns

type description
DialogResult The result of the pressed button, or the remembered result when the dialog is suppressed.

Remarks

The "Don't show again" choice is stored only when the user answers with a button other than Cancel, so cancelling a dialog never silences it.

See Also


IConfirmDialogService.Show<TViewModel> method (2 of 2)

Shows the dialog with the view of a view model as its content, unless the user has already asked not to see it.

Namespace: Eremex.AvaloniaUI.Controls.ApplicationServices
Assembly: Eremex.Common.Contracts.dll
NuGet Package: Eremex.Common.Contracts

Declaration

public DialogResult Show<TViewModel>(string key, TViewModel content, string title, 
    MessageBoxButtons buttons = MessageBoxButtons.OkCancel)
    where TViewModel : class

Type Parameters

name description
TViewModel The type of the content view model. It declares its view with ViewLocatorAttribute.

Parameters

name type description
key string Identifies the dialog. Dialogs with the same key are suppressed together, so use a distinct key for each message.
content TViewModel The view model shown in the body of the dialog. Its view becomes the content of the dialog and gets the view model as its data context.
title string The window caption.
buttons MessageBoxButtons The set of buttons to offer in the footer.

Returns

type description
DialogResult The result of the pressed button, or the remembered result when the dialog is suppressed.

Exceptions

exception condition
InvalidOperationException The type of content does not declare its view with ViewLocatorAttribute.

See Also