Files
Walleby/Wallet/CreateWalletViewModel.cs
T
2024-06-10 22:29:18 +01:00

27 lines
774 B
C#

using CommunityToolkit.Mvvm.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using Toolkit.Foundation;
namespace Wallet;
public partial class CreateWalletViewModel(IServiceProvider provider,
IServiceFactory factory,
IPublisher publisher,
IMediator mediator,
ISubscription subscriber,
IDisposer disposer) :
Observable(provider, factory, mediator, publisher, subscriber, disposer),
IPrimaryConfirmation
{
[MaybeNull]
[ObservableProperty]
private string name;
[MaybeNull]
[ObservableProperty]
private string password;
public async Task<bool> Confirm() =>
await Mediator.Handle<CreateEventArgs<Wallet<(string, string)>>,
bool>(Create.As(new Wallet<(string, string)>((Name, Password))));
}