Validation work

This commit is contained in:
TheXamlGuy
2024-06-15 22:16:02 +01:00
parent b94ca0ea30
commit 2e06b92e71
2 changed files with 12 additions and 5 deletions
+5 -1
View File
@@ -7,11 +7,11 @@
<StackPanel <StackPanel
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
IsEnabled="{Binding !Active}"
Spacing="12"> Spacing="12">
<PersonPicture <PersonPicture
Width="144" Width="144"
Height="144" Height="144"
Margin="0,-144,0,0"
DisplayName="{Binding Name}" /> DisplayName="{Binding Name}" />
<TextBlock <TextBlock
Text="{Binding Name}" Text="{Binding Name}"
@@ -28,5 +28,9 @@
</KeyBindingTriggerBehaviour> </KeyBindingTriggerBehaviour>
</Interaction.Behaviors> </Interaction.Behaviors>
</TextBox> </TextBox>
<ProgressRing
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsActive="{Binding Active}" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>
+5 -2
View File
@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using System.ComponentModel.DataAnnotations;
using Toolkit.Foundation; using Toolkit.Foundation;
namespace Wallet; namespace Wallet;
@@ -21,14 +22,16 @@ public partial class OpenWalletViewModel(IServiceProvider provider,
[RelayCommand] [RelayCommand]
private async Task Invoke() private async Task Invoke()
{
using (await new ActivityLock(this))
{ {
if (Password is { Length: > 0 }) if (Password is { Length: > 0 })
{ {
if (await Mediator.Handle<ActivateEventArgs<Wallet<string>>, if (await Mediator.Handle<ActivateEventArgs<Wallet<string>>, bool>(Activate.As(new Wallet<string>(Password))))
bool>(Activate.As(new Wallet<string>(Password))))
{ {
Publisher.Publish(Opened.As<Wallet>()); Publisher.Publish(Opened.As<Wallet>());
} }
} }
} }
} }
}