eliminate variable
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/VerifyRecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/VerifyRecoveryWordsViewModel.cs
@@ -19,9 +19,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets;
[NavigationMetaData(Title = "Verify Recovery Words")]
public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
{
+ private readonly Wallet _wallet;
+
[AutoNotify] private IEnumerable<string>? _suggestions;
[AutoNotify] private Mnemonic? _currentMnemonics;
- private readonly Wallet _wallet;
+ [AutoNotify] private bool _isMnemonicsValid;
public VerifyRecoveryWordsViewModel(Wallet wallet)
{
@@ -30,13 +32,11 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
_wallet = wallet;
Mnemonics.ToObservableChangeSet().ToCollection()
- .Select(x =>
- x.Count is 12 or 15 or 18 or 21 or 24
- ? new Mnemonic(GetTagsAsConcatString().ToLowerInvariant())
- : default)
+ .Select(x => x.Count is 12 or 15 or 18 or 21 or 24 ? new Mnemonic(GetTagsAsConcatString().ToLowerInvariant()) : default)
.Subscribe(x =>
{
CurrentMnemonics = x;
+ IsMnemonicsValid = x is { IsValidChecksum: true };
this.RaisePropertyChanged(nameof(Mnemonics));
});
@@ -44,10 +44,6 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
EnableBack = true;
- NextCommandCanExecute =
- this.WhenAnyValue(x => x.CurrentMnemonics)
- .Select(_ => IsMnemonicsValid);
-
NextCommand = ReactiveCommand.CreateFromTask(
async () => await OnNextAsync());
@@ -108,10 +104,6 @@ public partial class VerifyRecoveryWordsViewModel : RoutableViewModel
IsBusy = false;
}
- public bool IsMnemonicsValid => CurrentMnemonics is { IsValidChecksum: true };
-
- public IObservable<bool> NextCommandCanExecute { get; }
-
public ObservableCollection<string> Mnemonics { get; } = new();
private void ValidateMnemonics(IValidationErrors errors)

MODIFY
WalletWasabi.Fluent/Views/Wallets/VerifyRecoveryWordsView.axaml
WalletWasabi.Fluent/Views/Wallets/VerifyRecoveryWordsView.axaml
Classes="checkMark"
VerticalAlignment="Center"
DockPanel.Dock="Right"
- Opacity="{Binding NextCommandCanExecute^}" />
+ Opacity="{Binding IsMnemonicsValid}" />
<controls:TagsBox DockPanel.Dock="Left"
ItemCountLimit="24"
SuggestionsAreCaseSensitive="False"

eliminate variable