From 2e06b92e7145157fc384d5a69196381aa4ae671a Mon Sep 17 00:00:00 2001 From: TheXamlGuy Date: Sat, 15 Jun 2024 22:16:02 +0100 Subject: [PATCH] Validation work --- Wallet.Avalonia/OpenWalletView.axaml | 6 +++++- Wallet/OpenWalletViewModel.cs | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Wallet.Avalonia/OpenWalletView.axaml b/Wallet.Avalonia/OpenWalletView.axaml index 11245a6..e03d74d 100644 --- a/Wallet.Avalonia/OpenWalletView.axaml +++ b/Wallet.Avalonia/OpenWalletView.axaml @@ -7,11 +7,11 @@ + diff --git a/Wallet/OpenWalletViewModel.cs b/Wallet/OpenWalletViewModel.cs index 2d307c9..d3f0328 100644 --- a/Wallet/OpenWalletViewModel.cs +++ b/Wallet/OpenWalletViewModel.cs @@ -1,5 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using System.ComponentModel.DataAnnotations; using Toolkit.Foundation; namespace Wallet; @@ -22,12 +23,14 @@ public partial class OpenWalletViewModel(IServiceProvider provider, [RelayCommand] private async Task Invoke() { - if (Password is { Length: > 0 }) + using (await new ActivityLock(this)) { - if (await Mediator.Handle>, - bool>(Activate.As(new Wallet(Password)))) + if (Password is { Length: > 0 }) { - Publisher.Publish(Opened.As()); + if (await Mediator.Handle>, bool>(Activate.As(new Wallet(Password)))) + { + Publisher.Publish(Opened.As()); + } } } }