feat: add demo.
This commit is contained in:
31
demo/Ursa.Demo/ViewModels/PopConfirmDemoViewModel.cs
Normal file
31
demo/Ursa.Demo/ViewModels/PopConfirmDemoViewModel.cs
Normal 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"]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user