34 lines
889 B
C#
34 lines
889 B
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using Toolkit.Foundation;
|
|
|
|
namespace Wallet;
|
|
|
|
public partial class OpenWalletViewModel(IServiceProvider provider,
|
|
IServiceFactory factory,
|
|
IMediator mediator,
|
|
IPublisher publisher,
|
|
ISubscriber subscriber,
|
|
IDisposer disposer,
|
|
string name) :
|
|
Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
|
{
|
|
[ObservableProperty]
|
|
private string? name = name;
|
|
|
|
[ObservableProperty]
|
|
private string? password;
|
|
|
|
[RelayCommand]
|
|
private async Task Invoke()
|
|
{
|
|
if (Password is { Length: > 0 })
|
|
{
|
|
if (await Mediator.Handle<ActivateEventArgs<Wallet<string>>,
|
|
bool>(Activate.As(new Wallet<string>(Password))))
|
|
{
|
|
Publisher.Publish(Opened.As<Wallet>());
|
|
}
|
|
}
|
|
}
|
|
} |