Simplify constructors
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
@@ -40,13 +40,13 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
[AutoNotify] private bool _enableCancel;
public AddWalletPageViewModel(
- WalletManager walletManager,
- BitcoinStore store,
- Network network,
- ObservableCollection<WalletViewModelBase> wallets)
+ WalletManagerViewModel walletManagerViewModel,
+ BitcoinStore store)
{
Title = "Add Wallet";
SelectionMode = NavBarItemSelectionMode.Button;
+ var walletManager = walletManagerViewModel.Model;
+ var network = walletManager.Network;
var enableBack = default(IDisposable);
@@ -66,7 +66,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
.Subscribe(x => OptionsEnabled = x && !Validations.Any);
RecoverWalletCommand = ReactiveCommand.Create(
- () => Navigate().To(new RecoverWalletViewModel(WalletName, network, walletManager)));
+ () => Navigate().To(new RecoverWalletViewModel(WalletName, walletManagerViewModel)));
ImportWalletCommand = ReactiveCommand.CreateFromTask(async () =>
{
@@ -91,7 +91,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
}
});
- ConnectHardwareWalletCommand = ReactiveCommand.Create(() => Navigate().To(new ConnectHardwareWalletViewModel(WalletName, walletManager, wallets)));
+ ConnectHardwareWalletCommand = ReactiveCommand.Create(() => Navigate().To(new ConnectHardwareWalletViewModel(WalletName, walletManagerViewModel)));
CreateWalletCommand = ReactiveCommand.CreateFromTask(
async () =>

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/ConnectHardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/ConnectHardwareWalletViewModel.cs
@@ -26,13 +26,13 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
[AutoNotify] private bool _existingWalletFound;
[AutoNotify] private bool _nextButtonEnable;
- public ConnectHardwareWalletViewModel(string walletName, WalletManager walletManager, ObservableCollection<WalletViewModelBase> wallets)
+ public ConnectHardwareWalletViewModel(string walletName, WalletManagerViewModel walletManagerViewModel)
{
Title = "Hardware Wallet";
_message = "";
WalletName = walletName;
- WalletManager = walletManager;
- Wallets = wallets;
+ WalletManager = walletManagerViewModel.Model;
+ Wallets = walletManagerViewModel.Wallets;
AbandonedTasks = new AbandonedTasks();
CancelCts = new CancellationTokenSource();

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
@@ -27,11 +27,12 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
public RecoverWalletViewModel(
string walletName,
- Network network,
- WalletManager walletManager)
+ WalletManagerViewModel walletManagerViewModel)
{
Title = "Enter recovery words";
Suggestions = new Mnemonic(Wordlist.English, WordCount.Twelve).WordList.GetWords();
+ var walletManager = walletManagerViewModel.Model;
+ var network = walletManager.Network;
Mnemonics.ToObservableChangeSet().ToCollection()
.Select(x => x.Count == 12 ? new Mnemonic(GetTagsAsConcatString().ToLowerInvariant()) : default)

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -69,10 +69,8 @@ namespace WalletWasabi.Fluent.ViewModels
_walletManagerViewModel = new WalletManagerViewModel(global.WalletManager, global.UiConfig);
_addWalletPage = new AddWalletPageViewModel(
- global.WalletManager,
- global.BitcoinStore,
- global.Network,
- _walletManagerViewModel.Wallets);
+ _walletManagerViewModel,
+ global.BitcoinStore);
_settingsPage = new SettingsPageViewModel(global.Config, global.UiConfig);
_privacyMode = new PrivacyModeViewModel(global.UiConfig);

Simplify constructors