Fix SlideLock and add initial PINLock skeleton code.
MODIFY
WalletWasabi.Gui/Controls/LockScreen/LockScreen.xaml.cs
WalletWasabi.Gui/Controls/LockScreen/LockScreen.xaml.cs
@@ -50,14 +50,19 @@ namespace WalletWasabi.Gui.Controls.LockScreen
{
switch (obj)
{
- case LockScreenType.Simple:
- CurrentLockScreen = new SimpleLock();
- LockScreenHost.Content = CurrentLockScreen;
- break;
case LockScreenType.SlideLock:
+ CurrentLockScreen = new SlideLock();
+ break;
+ case LockScreenType.PINLock:
+ CurrentLockScreen = new PINLock();
+ break;
+ default:
+ CurrentLockScreen = new SimpleLock();
break;
}
+ LockScreenHost.Content = CurrentLockScreen;
+
ScreenImplDisposables?.Dispose();
ScreenImplDisposables = new CompositeDisposable();

MODIFY
WalletWasabi.Gui/Controls/LockScreen/SlideLock.xaml
WalletWasabi.Gui/Controls/LockScreen/SlideLock.xaml
<Styles.Resources>
<Template x:Key="Chevron">
<Path Stretch="Uniform"
+ Opacity="{Binding $parent[Border].Opacity}"
Fill="{DynamicResource ThemeForegroundBrush}"
Data="M 478.97852 464.25977
L 446.12109 470.33203
L 478.97852 464.25977 z "/>
</Template>
</Styles.Resources>
+
<Style Selector="Border.Chevron">
<Setter Property="Width" Value="103"/>
<Setter Property="Height" Value="50"/>
<Setter Property="TranslateTransform.Y" Value="100"/>
</KeyFrame>
<KeyFrame Cue="90%">
- <Setter Property="Opacity" Value="{Binding $parent[UserControl].Opacity}"/>
+ <Setter Property="Opacity" Value="{Binding #Shade.Opacity}"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.Y" Value="100"/>
</KeyFrame>
<KeyFrame Cue="90%">
- <Setter Property="Opacity" Value="{Binding $parent[UserControl].Opacity}"/>
+ <Setter Property="Opacity" Value="{Binding #Shade.Opacity}"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.Y" Value="100"/>
</KeyFrame>
<KeyFrame Cue="90%">
- <Setter Property="Opacity" Value="{Binding $parent[UserControl].Opacity}"/>
+ <Setter Property="Opacity" Value="{Binding #Shade.Opacity}"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
</Animation>
</Style.Animations>
</Style>
+
+ <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="100%">
+ <Setter Property="Opacity" Value="1"/>
+ <Setter Property="TranslateTransform.Y" Value="0"/>
+ <Setter Property="IsHitTestVisible" Value="True"/>
+ </KeyFrame>
+ </Animation>
+ </Style.Animations>
+ </Style>
+
+ <Style Selector="Grid.Unlocked">
+ <Style.Animations>
+ <Animation
+ FillMode="Both"
+ Duration="0:0:1.5"
+ Easing="QuarticEaseInOut">
+ <KeyFrame Cue="100%">
+ <Setter Property="Opacity" Value="0"/>
+ <Setter Property="TranslateTransform.Y" Value="-100"/>
+ <Setter Property="IsHitTestVisible" Value="False"/>
+ </KeyFrame>
+ </Animation>
+ </Style.Animations>
+ </Style>
</Styles>
</UserControl.Styles>
<Grid>
- <Thumb x:Name="PART_DragThumb">
- <Thumb.Template>
- <ControlTemplate>
- <Grid Background="{DynamicResource ThemeBackgroundBrush}">
+ <Grid x:Name="Shade" Background="{DynamicResource ThemeBackgroundBrush}">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid>
<Border Classes="Chevron Chev1"/>
<TextBlock Margin="0,110,0,0" Text="Drag and slide up to unlock."/>
</StackPanel>
</Grid>
+ <Thumb x:Name="PART_DragThumb">
+ <Thumb.Template>
+ <ControlTemplate>
+ <Border Background="Transparent"/>
</ControlTemplate>
</Thumb.Template>
</Thumb>

MODIFY
WalletWasabi.Gui/Controls/LockScreen/SlideLock.xaml.cs
WalletWasabi.Gui/Controls/LockScreen/SlideLock.xaml.cs
@@ -12,9 +12,14 @@ namespace WalletWasabi.Gui.Controls.LockScreen
{
internal class SlideLock : LockScreenImpl
{
+ private Grid Shade;
private Thumb DragThumb;
- private TranslateTransform DragThumbTransform;
- private bool UserDragInProgress, UnlockInProgress, UnlockDone;
+ private TranslateTransform TargetTransform;
+ private bool UserDragInProgress, StopSpring;
+
+ private const double ThresholdPercent = 1 / 6d;
+ private double RealThreshold;
+ private const double Stiffness = 0.12d;
private double _offset = 0;
private double Offset
@@ -23,21 +28,19 @@ namespace WalletWasabi.Gui.Controls.LockScreen
set => OnOffsetChanged(value);
}
- private const double ThresholdPercent = 1 / 6d;
- private double RealThreshold;
- private const double Stiffness = 0.12d;
-
- public SlideLock()
+ public SlideLock() : base()
{
InitializeComponent();
+ this.Shade = this.FindControl<Grid>("Shade");
this.DragThumb = this.FindControl<Thumb>("PART_DragThumb");
- DragThumbTransform = new TranslateTransform();
+
+ TargetTransform = new TranslateTransform();
DragThumb.DragCompleted += OnDragCompleted;
DragThumb.DragDelta += OnDragDelta;
DragThumb.DragStarted += OnDragStarted;
- DragThumb.RenderTransform = DragThumbTransform;
+ Shade.RenderTransform = TargetTransform;
this.WhenAnyValue(x => x.Bounds)
.Subscribe(OnBoundsChange);
@@ -47,6 +50,11 @@ namespace WalletWasabi.Gui.Controls.LockScreen
Clock.Subscribe(OnClockTick);
}
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+
private void OnBoundsChange(Rect obj)
{
var newHeight = obj.Height;
@@ -56,29 +64,19 @@ namespace WalletWasabi.Gui.Controls.LockScreen
private void OnOffsetChanged(double value)
{
_offset = value;
- DragThumbTransform.Y = _offset;
+ TargetTransform.Y = _offset;
}
private void OnClockTick(TimeSpan CurrentTime)
{
- if (UnlockDone) return;
-
- if (!UserDragInProgress & UnlockInProgress)
- {
- this.PseudoClasses.Add(":unlocked");
- UnlockInProgress = false;
- UnlockDone = true;
- IsLocked = false;
- return;
- }
-
if (!UserDragInProgress & Math.Abs(Offset) > RealThreshold)
{
- UnlockInProgress = true;
+ IsLocked = false;
+ StopSpring = true;
return;
}
- if (!UserDragInProgress && Offset != 0)
+ if (IsLocked & !UserDragInProgress & Offset != 0)
{
Offset *= 1 - Stiffness;
}
@@ -102,19 +100,18 @@ namespace WalletWasabi.Gui.Controls.LockScreen
UserDragInProgress = false;
}
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
public override void DoLock()
{
- throw new NotImplementedException();
+ Shade.Classes.Add("Locked");
+ Shade.Classes.Remove("Unlocked");
+ Offset = 0;
+ UserDragInProgress = false;
}
public override void DoUnlock()
{
- throw new NotImplementedException();
+ Shade.Classes.Add("Unlocked");
+ Shade.Classes.Remove("Locked");
}
}
}

MODIFY
WalletWasabi.Gui/Models/LockScreenType.cs
WalletWasabi.Gui/Models/LockScreenType.cs
@@ -9,8 +9,8 @@ namespace WalletWasabi.Gui.Models
/// </summary>
public enum LockScreenType
{
- Simple,
SlideLock,
PINLock,
+ Simple,
}
}
\ No newline at end of file

Fix SlideLock and add initial PINLock skeleton code.