| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ToastManagerOptions.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using MyNet.Primitives; |
| | | 9 | | using MyNet.UI.Notifications.Models; |
| | | 10 | | |
| | | 11 | | namespace MyNet.UI.Toasting.Settings; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Represents the configuration options for the ToastManager, allowing customization of toast display behavior such as |
| | | 15 | | /// </summary> |
| | | 16 | | public class ToastManagerOptions |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets or sets the maximum number of toasts that can be displayed simultaneously. If the number of active toasts e |
| | | 20 | | /// </summary> |
| | | 21 | | public int MaxVisibleToasts { get; set; } = 3; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets or sets the maximum number of toasts that can be queued. If the queue exceeds this limit, additional toasts |
| | | 25 | | /// </summary> |
| | | 26 | | public int MaxQueueSize { get; set; } = 50; |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets or sets the function used to determine the priority of a notification. Higher values indicate higher priori |
| | | 30 | | /// </summary> |
| | | 31 | | public Func<INotification, int> PrioritySelector { get; set; } = |
| | 54 | 32 | | n => n.Severity switch |
| | 54 | 33 | | { |
| | 54 | 34 | | NotificationSeverity.Error => 100, |
| | 54 | 35 | | NotificationSeverity.Warning => 80, |
| | 54 | 36 | | NotificationSeverity.Success => 50, |
| | 54 | 37 | | _ => 10 |
| | 54 | 38 | | }; |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets or sets the default duration for which a toast is displayed before it is automatically dismissed. This can |
| | | 42 | | /// </summary> |
| | 54 | 43 | | public TimeSpan DefaultDuration { get; set; } = 5.Seconds(); |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Gets or sets the default closing strategy applied when a toast is created. |
| | | 47 | | /// </summary> |
| | | 48 | | public ToastClosingStrategy DefaultClosingStrategy { get; set; } = ToastClosingStrategy.AutoClose; |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// Gets or sets a value indicating whether toasts pause auto-close while the pointer is over them. |
| | | 52 | | /// </summary> |
| | | 53 | | public bool DefaultFreezeOnMouseEnter { get; set; } = true; |
| | | 54 | | } |
| | | 55 | | |