feat: add demo.

This commit is contained in:
Dong Bin
2025-04-18 02:08:12 +08:00
parent c1d486297d
commit e9a94798e3
8 changed files with 138 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
using System.Windows.Input;
using Avalonia.Controls.Notifications;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Ursa.Controls;
namespace Ursa.Demo.ViewModels;
public partial class PopConfirmDemoViewModel: ObservableObject
{
internal WindowToastManager? ToastManager { get; set; }
public ICommand ConfirmCommand { get; }
public ICommand CancelCommand { get; }
public PopConfirmDemoViewModel()
{
ConfirmCommand = new RelayCommand(OnConfirm);
CancelCommand = new RelayCommand(OnCancel);
}
private void OnConfirm()
{
ToastManager?.Show(new Toast("Confirmed"), type: NotificationType.Success, classes: ["Light"]);
}
private void OnCancel()
{
ToastManager?.Show(new Toast("Canceled"), type:NotificationType.Error, classes: ["Light"]);
}
}