add focus boolean
MODIFY
WalletWasabi.Fluent/Behaviors/FocusTargetViaBoolean.cs
WalletWasabi.Fluent/Behaviors/FocusTargetViaBoolean.cs
@@ -10,18 +10,18 @@ namespace WalletWasabi.Fluent.Behaviors
{
public class FocusTargetViaBoolean : DisposingBehavior<Control>
{
- public static readonly StyledProperty<bool> FocusOnTargetProperty =
- AvaloniaProperty.Register<FocusNextItemBehavior, bool>(nameof(IsFocused), true);
+ public static readonly StyledProperty<bool> GotFocusedProperty =
+ AvaloniaProperty.Register<FocusTargetViaBoolean, bool>(nameof(GotFocused));
- public bool IsFocused
+ public bool GotFocused
{
- get => GetValue(FocusOnTargetProperty);
- set => SetValue(FocusOnTargetProperty, value);
+ get => GetValue(GotFocusedProperty);
+ set => SetValue(GotFocusedProperty, value);
}
protected override void OnAttached(CompositeDisposable disposables)
{
- this.WhenAnyValue(x => x.IsFocused)
+ this.WhenAnyValue(x => x.GotFocused)
.Where(x => x)
.Subscribe(_ => AssociatedObject?.Focus())
.DisposeWith(disposables);

MODIFY
WalletWasabi.Fluent/Controls/ContentArea.axaml
WalletWasabi.Fluent/Controls/ContentArea.axaml
<Button Name="PART_NextButton" Classes="action" IsVisible="{TemplateBinding EnableNext}" Content="{TemplateBinding NextContent}" Margin="10,10,0,10" HorizontalAlignment="Right" Command="{Binding NextCommand}">
<i:Interaction.Behaviors>
<behaviors:FocusOnAttachedBehavior IsEnabled="{Binding FocusNext}" />
+ <behaviors:FocusTargetViaBoolean GotFocused="{Binding FocusNextOnCanExecute}" />
</i:Interaction.Behaviors>
</Button>
</Panel>

MODIFY
WalletWasabi.Fluent/Controls/ContentArea.axaml.cs
WalletWasabi.Fluent/Controls/ContentArea.axaml.cs
@@ -33,6 +33,9 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<object> NextContentProperty =
AvaloniaProperty.Register<ContentArea, object>(nameof(NextContent), "Next");
+ public static readonly StyledProperty<bool> FocusNextOnCanExecuteProperty =
+ AvaloniaProperty.Register<ContentArea, bool>(nameof(FocusNextOnCanExecute));
+
private IContentPresenter? _titlePresenter;
private IContentPresenter? _captionPresenter;
@@ -90,6 +93,12 @@ namespace WalletWasabi.Fluent.Controls
set => SetValue(NextContentProperty, value);
}
+ public bool FocusNextOnCanExecute
+ {
+ get => GetValue(FocusNextOnCanExecuteProperty);
+ set => SetValue(FocusNextOnCanExecuteProperty, value);
+ }
+
protected override bool RegisterContentPresenter(IContentPresenter presenter)
{
var result = base.RegisterContentPresenter(presenter);

MODIFY
WalletWasabi.Fluent/ViewModels/RecoverWallet/RecoverWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/RecoverWallet/RecoverWalletViewModel.cs
@@ -24,8 +24,8 @@ namespace WalletWasabi.Fluent.ViewModels.RecoverWallet
private string? _selectedTag;
private IEnumerable<string>? _suggestions;
- public RecoverWalletViewModel(IScreen screen, string walletName, Network network, WalletManager walletManager) :
- base(screen)
+ public RecoverWalletViewModel(NavigationStateViewModel navigationState, string walletName, Network network,
+ WalletManager walletManager) : base(navigationState, NavigationTarget.Dialog)
{
Suggestions = new Mnemonic(Wordlist.English, WordCount.Twelve).WordList.GetWords();
@@ -78,7 +78,7 @@ namespace WalletWasabi.Fluent.ViewModels.RecoverWallet
var finishCommandCanExecute = this.WhenAnyValue(x => x.FinishCommandCanExecute)
.ObserveOn(RxApp.MainThreadScheduler);
- FinishCommand = ReactiveCommand.CreateFromTask(
+ NextCommand = ReactiveCommand.CreateFromTask(
async () =>
{
try
@@ -102,7 +102,8 @@ namespace WalletWasabi.Fluent.ViewModels.RecoverWallet
(int) MinGapLimit);
keyManager.SetNetwork(network);
walletManager.AddWallet(keyManager);
- screen.Router.NavigationStack.Clear();
+
+
}
catch (Exception ex)
{
@@ -111,13 +112,6 @@ namespace WalletWasabi.Fluent.ViewModels.RecoverWallet
},
finishCommandCanExecute);
- CancelCommand = ReactiveCommand.Create(
- () =>
- {
- AccountKeyPath = default;
- MinGapLimit = default;
- });
-
AdvancedOptionsInteraction = new Interaction<(KeyPath, int), (KeyPath?, int?)>();
AdvancedOptionsInteraction.RegisterHandler(
@@ -134,9 +128,7 @@ namespace WalletWasabi.Fluent.ViewModels.RecoverWallet
public ICommand AdvancedRecoveryOptionsDialogCommand { get; }
- public ICommand FinishCommand { get; }
-
- public ICommand CancelCommand { get; }
+ public ICommand NextCommand { get; }
private KeyPath? AccountKeyPath { get; set; } = KeyPath.Parse("m/84'/0'/0'");

MODIFY
WalletWasabi.Fluent/Views/RecoverWallet/RecoverWalletView.axaml
WalletWasabi.Fluent/Views/RecoverWallet/RecoverWalletView.axaml
HorizontalAlignment="Left" VerticalAlignment="Top">
<PathIcon Data="{DynamicResource arrow_left_regular}" />
</Button>
- <c:ContentArea Title="Enter recovery words" Caption="Type in your 12 recovery words and click Continue."
- Margin="44 0">
+ <c:ContentArea x:Name="RecoveryPageRoot"
+ Title="Enter recovery words" Caption="Type in your 12 recovery words and click continue"
+ EnableBack="True" FocusNextOnCanExecute="{Binding FinishCommandCanExecute}"
+ EnableCancel="True" CancelContent="Cancel"
+ EnableNext="True" NextContent="Finish">
<StackPanel>
<DockPanel>
<PathIcon Name="IconCheckmark" Classes="checkMark" Margin="15 42 0 0" VerticalAlignment="Top"
DockPanel.Dock="Right"
Opacity="{Binding FinishCommandCanExecute}" />
- <Label Content="_Type in your recovery words here:" Target="seedTagsBox" DockPanel.Dock="Top" />
- <c:TagsBox x:Name="seedTagsBox"
+ <Label Content="_Type in your recovery words here:" Target="SeedTagsBox" DockPanel.Dock="Top" />
+ <c:TagsBox x:Name="SeedTagsBox"
DockPanel.Dock="Top"
ItemCountLimit="12"
RestrictInputToSuggestions="True"
SelectedTag="{Binding SelectedTag}">
<i:Interaction.Behaviors>
<behaviors:FocusOnAttachedBehavior />
- <behaviors:FocusNextTargetViaBoolean TargetControl="BtFinished"
- FocusOnTarget="{Binding FinishCommandCanExecute}" />
</i:Interaction.Behaviors>
</c:TagsBox>
</DockPanel>
</StackPanel>
</StackPanel>
</c:ContentArea>
-
- <Button Content="Cancel" Command="{Binding CancelCommand}" Classes="invisible" HorizontalAlignment="Left"
- VerticalAlignment="Bottom" />
-
- <Button Name="BtFinished" Content="Restore" Command="{Binding FinishCommand}" Classes="action"
- HorizontalAlignment="Right"
- VerticalAlignment="Bottom" />
</Panel>
</UserControl>
\ No newline at end of file

add focus boolean