fix warnings. and shared base for navigatable items.
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
@@ -9,7 +9,6 @@ using System.Reactive.Linq;
using System.Windows.Input;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.Models;
-using WalletWasabi.Gui;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Wallets;
@@ -17,8 +16,8 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConfirmRecoveryWordsViewModel : ViewModelBase, IRoutableViewModel
{
- private ReadOnlyObservableCollection<RecoveryWord> _confirmationWords;
- private SourceList<RecoveryWord> _confirmationWordsSourceList;
+ private readonly ReadOnlyObservableCollection<RecoveryWord> _confirmationWords;
+ private readonly SourceList<RecoveryWord> _confirmationWordsSourceList;
public ConfirmRecoveryWordsViewModel(IScreen screen, List<RecoveryWord> mnemonicWords, KeyManager keyManager, WalletManager walletManager)
{
@@ -58,7 +57,6 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
public ReadOnlyObservableCollection<RecoveryWord> ConfirmationWords => _confirmationWords;
public ICommand FinishCommand { get; }
- public ICommand CancelCommand { get; }
private void SelectRandomConfirmationWords(List<RecoveryWord> mnemonicWords)
{

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoveryWordsViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoveryWordsViewModel.cs
@@ -4,16 +4,19 @@ using System.Collections.Generic;
using System.Windows.Input;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.Models;
-using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
- public class RecoveryWordsViewModel : ViewModelBase, IRoutableViewModel
+ public class RecoveryWordsViewModel : RoutableViewModel
{
- public RecoveryWordsViewModel(IScreen screen, KeyManager keyManager, Mnemonic mnemonic, WalletManager walletManager)
+ public RecoveryWordsViewModel(
+ IScreen screen,
+ KeyManager keyManager,
+ Mnemonic mnemonic,
+ WalletManager walletManager)
+ : base(screen)
{
- HostScreen = screen;
MnemonicWords = new List<RecoveryWord>();
for (int i = 0; i < mnemonic.Words.Length; i++)
@@ -21,15 +24,13 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
MnemonicWords.Add(new RecoveryWord(i + 1, mnemonic.Words[i]));
}
- ContinueCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new ConfirmRecoveryWordsViewModel(HostScreen, MnemonicWords, keyManager, walletManager)));
+ ContinueCommand = ReactiveCommand.Create(
+ () => screen.Router.Navigate.Execute(
+ new ConfirmRecoveryWordsViewModel(HostScreen, MnemonicWords, keyManager, walletManager)));
}
public ICommand ContinueCommand { get; }
- public ICommand CancelCommand { get; }
public List<RecoveryWord> MnemonicWords { get; set; }
-
- public string UrlPathSegment { get; }
- public IScreen HostScreen { get; }
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -44,9 +44,9 @@ namespace WalletWasabi.Fluent.ViewModels
}
});
- PasswordInteraction = new Interaction<string, string>();
+ PasswordInteraction = new Interaction<string, string?>();
PasswordInteraction.RegisterHandler(
- async interaction => interaction.SetOutput(await new EnterPasswordViewModel(screen).ShowDialogAsync()));
+ async interaction => interaction.SetOutput(await new EnterPasswordViewModel().ShowDialogAsync()));
}
public override string IconName => "add_circle_regular";
@@ -63,7 +63,7 @@ namespace WalletWasabi.Fluent.ViewModels
set => this.RaiseAndSetIfChanged(ref _optionsEnabled, value);
}
- public Interaction<string, string> PasswordInteraction { get; }
+ private Interaction<string, string?> PasswordInteraction { get; }
public ICommand CreateWalletCommand { get; }
public ICommand RecoverWalletCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
@@ -7,16 +7,13 @@ using WalletWasabi.Userfacing;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
- public class EnterPasswordViewModel : DialogViewModelBase<string>
+ public class EnterPasswordViewModel : DialogViewModelBase<string?>
{
- private IScreen _screen;
- private string _password;
- private string _confirmPassword;
+ private string? _password;
+ private string? _confirmPassword;
- public EnterPasswordViewModel(IScreen screen)
+ public EnterPasswordViewModel()
{
- _screen = screen;
-
this.ValidateProperty(x => x.Password, ValidatePassword);
this.ValidateProperty(x => x.ConfirmPassword, ValidateConfirmPassword);
@@ -34,16 +31,16 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
.ObserveOn(RxApp.MainThreadScheduler);
ContinueCommand = ReactiveCommand.Create(() => Close(Password), continueCommandCanExecute);
- CancelCommand = ReactiveCommand.Create(() => Close(null!));
+ CancelCommand = ReactiveCommand.Create(() => Close());
}
- public string Password
+ public string? Password
{
get => _password;
set => this.RaiseAndSetIfChanged(ref _password, value);
}
- public string ConfirmPassword
+ public string? ConfirmPassword
{
get => _confirmPassword;
set => this.RaiseAndSetIfChanged(ref _confirmPassword, value);

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -3,7 +3,6 @@ using ReactiveUI;
using System.Reactive;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Fluent.ViewModels.Dialogs;
-using System;
using Global = WalletWasabi.Gui.Global;
namespace WalletWasabi.Fluent.ViewModels

MODIFY
WalletWasabi.Fluent/ViewModels/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBarItemViewModel.cs
using ReactiveUI;
-using System;
-using System.Reactive;
-using WalletWasabi.Gui.ViewModels;
+using System.Windows.Input;
namespace WalletWasabi.Fluent.ViewModels
{
- public abstract class NavBarItemViewModel : ViewModelBase, IRoutableViewModel
+ public abstract class NavBarItemViewModel : RoutableViewModel
{
private bool _isSelected;
private bool _isExpanded;
- private string _title;
+ private string? _title;
- public NavBarItemViewModel(IScreen screen)
+ protected NavBarItemViewModel(IScreen screen) : base(screen)
{
- HostScreen = screen;
-
- OpenCommand = ReactiveCommand.Create(() =>
- {
- screen.Router.Navigate.Execute(this);
- });
+ OpenCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(this));
}
- public NavBarItemViewModel Parent { get; set; }
+ public NavBarItemViewModel? Parent { get; set; }
public abstract string IconName { get; }
- public string UrlPathSegment { get; } = Guid.NewGuid().ToString().Substring(0, 5);
-
- public IScreen HostScreen { get; }
-
public bool IsExpanded
{
get => _isExpanded;
@@ -43,7 +32,7 @@ namespace WalletWasabi.Fluent.ViewModels
}
}
- public string Title
+ public string? Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
@@ -55,6 +44,6 @@ namespace WalletWasabi.Fluent.ViewModels
set => this.RaiseAndSetIfChanged(ref _isSelected, value);
}
- public ReactiveCommand<Unit, Unit> OpenCommand { get; }
+ public ICommand OpenCommand { get; }
}
}

ADD
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
+using System;
+using ReactiveUI;
+using WalletWasabi.Gui.ViewModels;
+
+namespace WalletWasabi.Fluent.ViewModels
+{
+ public abstract class RoutableViewModel : ViewModelBase, IRoutableViewModel
+ {
+ protected RoutableViewModel(IScreen screen)
+ {
+ HostScreen = screen;
+ }
+
+ public string UrlPathSegment { get; } = Guid.NewGuid().ToString().Substring(0, 5);
+
+ public IScreen HostScreen { get; }
+ }
+}
\ No newline at end of file

fix warnings. and shared base for navigatable items.