Some fixes to SimpleLock
MODIFY
WalletWasabi.Gui/Controls/LockScreen/SimpleLock.xaml
WalletWasabi.Gui/Controls/LockScreen/SimpleLock.xaml
xmlns:lockscreen="clr-namespace:WalletWasabi.Gui.Controls.LockScreen;assembly=WalletWasabi.Gui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Styles>
+
+ <Style Selector="Grid#Shade">
+ <Setter Property="Opacity" Value="0"/>
+ <Setter Property="TranslateTransform.Y" Value="-100"/>
+ </Style>
+
<Style Selector="Grid.Locked">
<Style.Animations>
<Animation
FillMode="Both"
Duration="0:0:1.5"
Easing="QuarticEaseInOut">
- <KeyFrame Cue="0%">
- <Setter Property="Opacity" Value="0"/>
- <Setter Property="TranslateTransform.Y" Value="-100"/>
- <Setter Property="IsHitTestVisible" Value="False"/>
- </KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</Animation>
</Style.Animations>
</Style>
+
<Style Selector="Grid.Unlocked">
<Style.Animations>
<Animation
FillMode="Both"
Duration="0:0:1.5"
Easing="QuarticEaseInOut">
- <KeyFrame Cue="0%">
- <Setter Property="Opacity" Value="1"/>
- <Setter Property="IsHitTestVisible" Value="True"/>
- </KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
</Animation>
</Style.Animations>
</Style>
+
</UserControl.Styles>
<Grid>
- <Grid x:Name="Shade" Background="{DynamicResource ThemeBackgroundBrush}">
+ <Grid x:Name="Shade" Classes="Unlocked" Background="{DynamicResource ThemeBackgroundBrush}">
<Button x:Name="UnlockButton"
Width="100"
Height="100"

MODIFY
WalletWasabi.Gui/Controls/LockScreen/SimpleLock.xaml.cs
WalletWasabi.Gui/Controls/LockScreen/SimpleLock.xaml.cs
@@ -18,8 +18,8 @@ namespace WalletWasabi.Gui.Controls.LockScreen
public SimpleLock()
{
InitializeComponent();
- var unlockButton = this.FindControl<Button>("UnlockButton");
+ var unlockButton = this.FindControl<Button>("UnlockButton");
this.Shade = this.FindControl<Grid>("Shade");
unlockButton.Click += unlockButton_Clicked;
@@ -28,17 +28,27 @@ namespace WalletWasabi.Gui.Controls.LockScreen
.Subscribe(IsLockedChanged);
}
- private void IsLockedChanged(bool obj)
+ private void IsLockedChanged(bool isLocked)
{
- if (obj)
+ if (isLocked)
{
+ if (Shade.Classes.Contains("Locked"))
+ return;
+
Shade.Classes.Add("Locked");
Shade.Classes.Remove("Unlocked");
+
+ this.IsHitTestVisible = true;
}
else
{
+ if (Shade.Classes.Contains("Unlocked"))
+ return;
+
Shade.Classes.Add("Unlocked");
Shade.Classes.Remove("Locked");
+
+ this.IsHitTestVisible = false;
}
}

MODIFY
WalletWasabi.Gui/ViewModels/LockScreenViewModel.cs
WalletWasabi.Gui/ViewModels/LockScreenViewModel.cs
@@ -48,6 +48,8 @@ namespace WalletWasabi.Gui.ViewModels
public void Initialize()
{
+ OnLockScreenTypeChange(Global.UiConfig.LockScreenType);
+
Global.UiConfig.WhenAnyValue(x => x.LockScreenActive)
.Subscribe(OnLockScreenActiveChange)
.DisposeWith(Disposables);
@@ -56,12 +58,9 @@ namespace WalletWasabi.Gui.ViewModels
.Subscribe(OnLockScreenTypeChange)
.DisposeWith(Disposables);
- OnLockScreenTypeChange(Global.UiConfig.LockScreenType);
-
ActiveLockScreen.WhenAnyValue(x => x.IsLocked)
.Subscribe(ActiveLockScreenIsLockedChanged)
.DisposeWith(Disposables);
-
}
private void ActiveLockScreenIsLockedChanged(bool obj)
@@ -73,7 +72,8 @@ namespace WalletWasabi.Gui.ViewModels
// Registers oncoming changes from settings
private void OnLockScreenActiveChange(bool? obj)
{
- if (ActiveLockScreen is null) return;
+ if (ActiveLockScreen is null)
+ return;
if (ActiveLockScreen.IsLocked != obj)
ActiveLockScreen.IsLocked = obj ?? false;

Some fixes to SimpleLock