use notifications for pin lock screen.
MODIFY
WalletWasabi.Gui/Controls/LockScreen/PinLockScreen.xaml
WalletWasabi.Gui/Controls/LockScreen/PinLockScreen.xaml
<controls:GroupBox VerticalAlignment="Center" HorizontalAlignment="Center" TextBlock.FontSize="25" Padding="20" Margin="10">
<DockPanel LastChildFill="True">
<controls:TogglePasswordBox x:Name="InputField" Text="{Binding PinInput}" Width="300" DockPanel.Dock="Top" Margin="4 0 4 20" Watermark="PIN" />
- <Grid DockPanel.Dock="Bottom">
- <TextBlock Text="Wrong PIN!" Margin="0,12,0,0" VerticalAlignment="Center" FontSize="20" Classes="warningMessage" IsVisible="{Binding WarningMessageVisible}" />
- </Grid>
<Grid RowDefinitions="*,*,*,*" ColumnDefinitions="*,*,*">
<Grid.Styles>
<Style Selector="Button">

MODIFY
WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs
WalletWasabi.Gui/Controls/LockScreen/PinLockScreenViewModel.cs
@@ -5,6 +5,7 @@ using System.Reactive;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Reactive.Linq;
+using WalletWasabi.Gui.Helpers;
namespace WalletWasabi.Gui.Controls.LockScreen
{
@@ -27,14 +28,6 @@ namespace WalletWasabi.Gui.Controls.LockScreen
set => this.RaiseAndSetIfChanged(ref _pinInput, value);
}
- private bool _warningMessageVisible;
-
- public bool WarningMessageVisible
- {
- get => _warningMessageVisible;
- set => this.RaiseAndSetIfChanged(ref _warningMessageVisible, value);
- }
-
public PinLockScreenViewModel(LockScreenViewModel lockScreenViewModel)
{
ParentVM = Guard.NotNull(nameof(lockScreenViewModel), lockScreenViewModel);
@@ -48,13 +41,11 @@ namespace WalletWasabi.Gui.Controls.LockScreen
if (PinInput.Length > 0)
{
PinInput = PinInput.Substring(0, PinInput.Length - 1);
- WarningMessageVisible = false;
}
}
else if (arg == "CLEAR")
{
PinInput = string.Empty;
- WarningMessageVisible = false;
}
else
{
@@ -65,19 +56,12 @@ namespace WalletWasabi.Gui.Controls.LockScreen
this.WhenAnyValue(x => x.PinInput)
.Throttle(TimeSpan.FromSeconds(1))
.ObserveOn(RxApp.MainThreadScheduler)
+ .Where(x => !string.IsNullOrWhiteSpace(x))
.Subscribe(x =>
{
- if (string.IsNullOrWhiteSpace(x))
- {
- WarningMessageVisible = false;
- }
- else if (ParentVM.PinHash == HashHelpers.GenerateSha256Hash(x))
- {
- WarningMessageVisible = false;
- }
- else
+ if (ParentVM.PinHash != HashHelpers.GenerateSha256Hash(x))
{
- WarningMessageVisible = true;
+ NotificationHelpers.Error("PIN is incorrect!");
}
});

use notifications for pin lock screen.