# IConfirmDialogService.Show method (1 of 2)

Shows the dialog unless the user has already asked not to see it.

**Namespace:** [`Eremex.AvaloniaUI.Controls.ApplicationServices`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/index.md)  
**Assembly:** `Eremex.Common.Contracts.dll`  
**NuGet Package:** [Eremex.Common.Contracts](https://www.nuget.org/packages/Eremex.Common.Contracts)

## Declaration

```csharp
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`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxIcon/index.md) | The icon shown next to the messages. |
| buttons | [`MessageBoxButtons`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxButtons/index.md) | The set of buttons to offer in the footer. |

## Returns

| type | description |
| --- | --- |
| [`DialogResult`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/DialogResult/index.md) | 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

* enum [DialogResult](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/DialogResult/index.md)
* enum [MessageBoxIcon](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxIcon/index.md)
* enum [MessageBoxButtons](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxButtons/index.md)
* interface [IConfirmDialogService](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/IConfirmDialogService/index.md)
* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/index.md)

---

# IConfirmDialogService.Show&lt;TViewModel&gt; 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`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/index.md)  
**Assembly:** `Eremex.Common.Contracts.dll`  
**NuGet Package:** [Eremex.Common.Contracts](https://www.nuget.org/packages/Eremex.Common.Contracts)

## Declaration

```csharp
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`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxButtons/index.md) | The set of buttons to offer in the footer. |

## Returns

| type | description |
| --- | --- |
| [`DialogResult`](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/DialogResult/index.md) | 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

* enum [DialogResult](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/DialogResult/index.md)
* enum [MessageBoxButtons](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls/MessageBoxButtons/index.md)
* interface [IConfirmDialogService](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/IConfirmDialogService/index.md)
* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](https://eremexcontrols.net/API/Eremex.AvaloniaUI.Controls.ApplicationServices/index.md)

<!-- DO NOT EDIT: generated by xmldocmd for Eremex.Common.Contracts.dll -->
