Fixed issue when locking and unlocking the same wallet

This commit is contained in:
TheXamlGuy
2024-07-12 20:13:26 +01:00
parent 4846532d93
commit f17ffcbaf6
4 changed files with 82 additions and 37 deletions
+38 -10
View File
@@ -37,16 +37,44 @@
<PersonPicture
Height="40"
DisplayName="{Binding Name}"
ProfilePicture="{Binding ImageDescriptor.Image}" />
<TextBlock
Margin="0,0,0,-2"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
FontFamily="{DynamicResource FluentThemeFontFamily}"
FontSize="16"
Foreground="{DynamicResource StarredIconForegroundBrush}"
IsVisible="{Binding IsFavourite}"
Text="&#xEF60;" />
ProfilePicture="{Binding ImageDescriptor.Image}">
<PersonPicture.Clip>
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,0,40,40" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<PathGeometry Figures="F1 M 4.21875 19.53125 C 4.049479 19.53125 3.902995 19.467773 3.779297 19.34082 C 3.655599 19.213867 3.59375 19.065756 3.59375 18.896484 C 3.59375 18.850912 3.597005 18.815104 3.603516 18.789062 L 4.648438 12.675781 L 0.205078 8.349609 C 0.08138 8.225912 0.019531 8.079428 0.019531 7.910156 C 0.019531 7.760417 0.071615 7.623698 0.175781 7.5 C 0.279948 7.376303 0.406901 7.301434 0.556641 7.275391 L 6.689453 6.386719 L 9.443359 0.820312 C 9.495442 0.716146 9.571939 0.633139 9.672852 0.571289 C 9.773763 0.509441 9.879557 0.478516 9.990234 0.478516 C 10.107422 0.478516 10.218099 0.507812 10.322266 0.566406 C 10.426432 0.625 10.504557 0.709637 10.556641 0.820312 L 13.310547 6.386719 L 19.443359 7.275391 C 19.599609 7.301434 19.728189 7.373048 19.829102 7.490234 C 19.930012 7.607423 19.980469 7.744142 19.980469 7.900391 C 19.980469 8.082683 19.918619 8.232422 19.794922 8.349609 L 15.351562 12.675781 L 16.396484 18.789062 C 16.402994 18.815104 16.40625 18.850912 16.40625 18.896484 C 16.40625 19.065756 16.3444 19.21224 16.220703 19.335938 C 16.097004 19.459635 15.950521 19.521484 15.78125 19.521484 C 15.670572 19.521484 15.572916 19.498697 15.488281 19.453125 L 10 16.5625 L 4.511719 19.453125 C 4.420573 19.505209 4.322917 19.53125 4.21875 19.53125 Z ">
<PathGeometry.Transform>
<TransformGroup>
<TranslateTransform X="25" Y="25" />
<ScaleTransform ScaleX="0.900" ScaleY="0.900" />
</TransformGroup>
</PathGeometry.Transform>
</PathGeometry>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</PersonPicture.Clip>
</PersonPicture>
<Rectangle ClipToBounds="False" Fill="{DynamicResource StarredIconForegroundBrush}">
<Rectangle.Clip>
<CombinedGeometry GeometryCombineMode="Intersect">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,0,50,50" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<PathGeometry Figures="F1 M 4.21875 19.53125 C 4.049479 19.53125 3.902995 19.467773 3.779297 19.34082 C 3.655599 19.213867 3.59375 19.065756 3.59375 18.896484 C 3.59375 18.850912 3.597005 18.815104 3.603516 18.789062 L 4.648438 12.675781 L 0.205078 8.349609 C 0.08138 8.225912 0.019531 8.079428 0.019531 7.910156 C 0.019531 7.760417 0.071615 7.623698 0.175781 7.5 C 0.279948 7.376303 0.406901 7.301434 0.556641 7.275391 L 6.689453 6.386719 L 9.443359 0.820312 C 9.495442 0.716146 9.571939 0.633139 9.672852 0.571289 C 9.773763 0.509441 9.879557 0.478516 9.990234 0.478516 C 10.107422 0.478516 10.218099 0.507812 10.322266 0.566406 C 10.426432 0.625 10.504557 0.709637 10.556641 0.820312 L 13.310547 6.386719 L 19.443359 7.275391 C 19.599609 7.301434 19.728189 7.373048 19.829102 7.490234 C 19.930012 7.607423 19.980469 7.744142 19.980469 7.900391 C 19.980469 8.082683 19.918619 8.232422 19.794922 8.349609 L 15.351562 12.675781 L 16.396484 18.789062 C 16.402994 18.815104 16.40625 18.850912 16.40625 18.896484 C 16.40625 19.065756 16.3444 19.21224 16.220703 19.335938 C 16.097004 19.459635 15.950521 19.521484 15.78125 19.521484 C 15.670572 19.521484 15.572916 19.498697 15.488281 19.453125 L 10 16.5625 L 4.511719 19.453125 C 4.420573 19.505209 4.322917 19.53125 4.21875 19.53125 Z ">
<PathGeometry.Transform>
<TransformGroup>
<TranslateTransform X="43" Y="43" />
<ScaleTransform ScaleX="0.600" ScaleY="0.600" />
</TransformGroup>
</PathGeometry.Transform>
</PathGeometry>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Rectangle.Clip>
</Rectangle>
</Grid>
<StackPanel Grid.Column="1" Margin="12,0,0,0">
<TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
+1 -1
View File
@@ -13,7 +13,7 @@
MenuItemsSource="{Binding}"
SelectedItem="{Binding SelectedItem}">
<Interaction.Behaviors>
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened}" Value="True">
<DataTriggerBehavior Binding="{ReflectionBinding SelectedItem.IsOpened, Mode=TwoWay}" Value="True">
<InvokeNavigationViewItemAction SelectedIndex="1" />
</DataTriggerBehavior>
</Interaction.Behaviors>
+38 -22
View File
@@ -26,6 +26,20 @@
</NavigateAction>
</ConditionAction>
</AttachedEventTriggerBehaviour>
<DataTriggerBehavior Binding="{Binding IsOpened}" Value="False">
<ConditionAction>
<ConditionAction.Condition>
<ConditionalExpression ForwardChaining="And">
<ComparisonCondition LeftOperand="{Binding IsActivated}" RightOperand="True" />
<ComparisonCondition LeftOperand="{Binding IsOpened}" RightOperand="True" />
</ConditionalExpression>
</ConditionAction.Condition>
<NavigateAction Region="Main" Route="OpenWallet">
<Parameter Key="Name" Value="{Binding Name}" />
<Parameter Key="ImageDescriptor" Value="{Binding ImageDescriptor}" />
</NavigateAction>
</ConditionAction>
</DataTriggerBehavior>
</Interaction.Behaviors>
<Grid>
<PersonPicture
@@ -33,27 +47,29 @@
Height="{StaticResource IconSize}"
DisplayName="{Binding Name}"
ProfilePicture="{Binding ImageDescriptor.Image}" />
<Button
Width="{StaticResource IconSize}"
Height="{StaticResource IconSize}"
Background="Transparent"
CornerRadius="{StaticResource IconCornerRadius}"
IsVisible="{Binding IsActivated}">
<Button.Flyout>
<MenuFlyout>
<MenuItem
Width="216"
Command="{Binding LockCommand}"
Header="Lock">
<MenuItem.Icon>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 10 14.799999 C 10.266666 14.799999 10.499999 14.699999 10.7 14.5 C 10.9 14.299999 11 14.066667 11 13.799999 C 11 13.533333 10.9 13.299999 10.7 13.099999 C 10.499999 12.9 10.266666 12.799999 10 12.799999 C 9.733333 12.799999 9.499999 12.9 9.3 13.099999 C 9.099999 13.299999 9 13.533333 9 13.799999 C 9 14.066667 9.099999 14.299999 9.3 14.5 C 9.499999 14.699999 9.733333 14.799999 10 14.799999 Z M 6 7.799999 L 7 7.799999 L 7 6.799999 C 7 5.973333 7.293333 5.266666 7.88 4.68 C 8.466666 4.093334 9.173333 3.799999 10 3.799999 C 10.826666 3.799999 11.533333 4.093334 12.12 4.68 C 12.706666 5.266666 13 5.973333 13 6.799999 L 13 7.799999 L 14 7.799999 C 14.826666 7.799999 15.533332 8.093332 16.119999 8.679999 C 16.706665 9.266666 17 9.973333 17 10.799999 L 17 16.799999 C 17 17.626667 16.706665 18.333332 16.119999 18.92 C 15.533332 19.506666 14.826666 19.799999 14 19.799999 L 6 19.799999 C 5.173333 19.799999 4.466666 19.506666 3.88 18.92 C 3.293333 18.333332 3 17.626667 3 16.799999 L 3 10.799999 C 3 9.973333 3.293333 9.266666 3.88 8.679999 C 4.466666 8.093332 5.173333 7.799999 6 7.799999 Z M 10 4.799999 C 9.44 4.799999 8.966666 4.993332 8.58 5.379999 C 8.193333 5.766666 8 6.240001 8 6.799999 L 8 7.799999 L 12 7.799999 L 12 6.799999 C 12 6.240001 11.806666 5.766666 11.42 5.379999 C 11.033333 4.993332 10.559999 4.799999 10 4.799999 Z M 16 10.799999 C 16 10.24 15.806666 9.766666 15.42 9.379999 C 15.033333 8.993333 14.559999 8.799999 14 8.799999 L 6 8.799999 C 5.44 8.799999 4.966666 8.993333 4.58 9.379999 C 4.193333 9.766666 4 10.24 4 10.799999 L 4 16.799999 C 4 17.360001 4.193333 17.833332 4.58 18.219999 C 4.966666 18.606667 5.44 18.799999 6 18.799999 L 14 18.799999 C 14.559999 18.799999 15.033333 18.606667 15.42 18.219999 C 15.806666 17.833332 16 17.360001 16 16.799999 Z " />
</MenuItem.Icon>
</MenuItem>
</MenuFlyout>
</Button.Flyout>
</Button>
<Grid IsVisible="{Binding IsActivated}">
<Button
Width="{StaticResource IconSize}"
Height="{StaticResource IconSize}"
Background="Transparent"
CornerRadius="{StaticResource IconCornerRadius}"
IsVisible="{Binding IsOpened}">
<Button.Flyout>
<MenuFlyout>
<MenuItem
Width="216"
Command="{Binding LockCommand}"
Header="Lock">
<MenuItem.Icon>
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 10 14.799999 C 10.266666 14.799999 10.499999 14.699999 10.7 14.5 C 10.9 14.299999 11 14.066667 11 13.799999 C 11 13.533333 10.9 13.299999 10.7 13.099999 C 10.499999 12.9 10.266666 12.799999 10 12.799999 C 9.733333 12.799999 9.499999 12.9 9.3 13.099999 C 9.099999 13.299999 9 13.533333 9 13.799999 C 9 14.066667 9.099999 14.299999 9.3 14.5 C 9.499999 14.699999 9.733333 14.799999 10 14.799999 Z M 6 7.799999 L 7 7.799999 L 7 6.799999 C 7 5.973333 7.293333 5.266666 7.88 4.68 C 8.466666 4.093334 9.173333 3.799999 10 3.799999 C 10.826666 3.799999 11.533333 4.093334 12.12 4.68 C 12.706666 5.266666 13 5.973333 13 6.799999 L 13 7.799999 L 14 7.799999 C 14.826666 7.799999 15.533332 8.093332 16.119999 8.679999 C 16.706665 9.266666 17 9.973333 17 10.799999 L 17 16.799999 C 17 17.626667 16.706665 18.333332 16.119999 18.92 C 15.533332 19.506666 14.826666 19.799999 14 19.799999 L 6 19.799999 C 5.173333 19.799999 4.466666 19.506666 3.88 18.92 C 3.293333 18.333332 3 17.626667 3 16.799999 L 3 10.799999 C 3 9.973333 3.293333 9.266666 3.88 8.679999 C 4.466666 8.093332 5.173333 7.799999 6 7.799999 Z M 10 4.799999 C 9.44 4.799999 8.966666 4.993332 8.58 5.379999 C 8.193333 5.766666 8 6.240001 8 6.799999 L 8 7.799999 L 12 7.799999 L 12 6.799999 C 12 6.240001 11.806666 5.766666 11.42 5.379999 C 11.033333 4.993332 10.559999 4.799999 10 4.799999 Z M 16 10.799999 C 16 10.24 15.806666 9.766666 15.42 9.379999 C 15.033333 8.993333 14.559999 8.799999 14 8.799999 L 6 8.799999 C 5.44 8.799999 4.966666 8.993333 4.58 9.379999 C 4.193333 9.766666 4 10.24 4 10.799999 L 4 16.799999 C 4 17.360001 4.193333 17.833332 4.58 18.219999 C 4.966666 18.606667 5.44 18.799999 6 18.799999 L 14 18.799999 C 14.559999 18.799999 15.033333 18.606667 15.42 18.219999 C 15.806666 17.833332 16 17.360001 16 16.799999 Z " />
</MenuItem.Icon>
</MenuItem>
</MenuFlyout>
</Button.Flyout>
</Button>
</Grid>
</Grid>
</ListBoxItem>
+5 -4
View File
@@ -29,10 +29,11 @@ public partial class MainViewModel :
{
if (args.Sender is WalletNavigationViewModel wallet)
{
SelectedItem = null;
Reset(args => args.SetSource(wallet), false);
SelectedItem = wallet;
Reset(args =>
{
args.SetSource(wallet, () => wallet);
SelectedItem = wallet;
}, false);
}
else
{