| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="MessageBoxOptions.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | namespace MyNet.UI.Dialogs.MessageBox; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Options for configuring the message box dialog. |
| | | 11 | | /// </summary> |
| | | 12 | | public sealed class MessageBoxOptions |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the message displayed in the message box. |
| | | 16 | | /// </summary> |
| | | 17 | | public string Message { get; internal set; } = string.Empty; |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the title of the message box. |
| | | 21 | | /// </summary> |
| | | 22 | | public string? Title { get; internal set; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets the severity of the message (Info, Warning, Error, etc.). |
| | | 26 | | /// </summary> |
| | | 27 | | public MessageSeverity Severity { get; internal set; } = MessageSeverity.Information; |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets the buttons displayed in the message box. |
| | | 31 | | /// </summary> |
| | | 32 | | public MessageBoxResultOption Buttons { get; internal set; } = MessageBoxResultOption.Ok; |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets the default selected result. |
| | | 36 | | /// </summary> |
| | | 37 | | public MessageBoxResult DefaultResult { get; internal set; } = MessageBoxResult.Ok; |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Creates a configured <see cref="MessageBoxOptions"/> instance for use with <see cref="IMessageBoxFactory"/>. |
| | | 41 | | /// </summary> |
| | | 42 | | public static MessageBoxOptions Create( |
| | | 43 | | string message, |
| | | 44 | | string? title = null, |
| | | 45 | | MessageSeverity severity = MessageSeverity.Information, |
| | | 46 | | MessageBoxResultOption buttons = MessageBoxResultOption.Ok, |
| | | 47 | | MessageBoxResult defaultResult = MessageBoxResult.Ok) |
| | 0 | 48 | | => new() |
| | 0 | 49 | | { |
| | 0 | 50 | | Message = message, |
| | 0 | 51 | | Title = title, |
| | 0 | 52 | | Severity = severity, |
| | 0 | 53 | | Buttons = buttons, |
| | 0 | 54 | | DefaultResult = defaultResult |
| | 0 | 55 | | }; |
| | | 56 | | } |
| | | 57 | | |