Files
Nitrox/Nitrox.Launcher/Models/Design/NotificationItem.cs
2025-07-06 00:23:46 +02:00

29 lines
830 B
C#

using System.Windows.Input;
using Avalonia.Controls.Notifications;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
namespace Nitrox.Launcher.Models.Design;
public partial class NotificationItem : ObservableObject
{
public string Message { get; }
public NotificationType Type { get; }
public ICommand CloseCommand { get; }
[ObservableProperty]
private bool dismissed;
public NotificationItem()
{
}
public NotificationItem(string message, NotificationType type = NotificationType.Information, ICommand closeCommand = null)
{
Message = message;
Type = type;
CloseCommand = closeCommand ?? new RelayCommand(() => WeakReferenceMessenger.Default.Send(new NotificationCloseMessage(this)));
}
}