pass in dependencies to AddWalletPageViewModel
MODIFY
WalletWasabi.Fluent/AddWallet/Common/EnterPasswordViewModel.cs
WalletWasabi.Fluent/AddWallet/Common/EnterPasswordViewModel.cs
using ReactiveUI;
-using System;
using System.Reactive.Linq;
using System.Windows.Input;
-using WalletWasabi.Blockchain.Keys;
-using WalletWasabi.Fluent.AddWallet.CreateWallet;
-using WalletWasabi.Fluent.ViewModels;
using WalletWasabi.Fluent.ViewModels.Dialogs;
-using WalletWasabi.Gui;
using WalletWasabi.Gui.Validation;
-using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Models;
using WalletWasabi.Userfacing;

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -8,6 +8,9 @@ using WalletWasabi.Gui;
using System.Reactive.Threading.Tasks;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.AddWallet.CreateWallet;
+using WalletWasabi.Wallets;
+using WalletWasabi.Stores;
+using NBitcoin;
namespace WalletWasabi.Fluent.ViewModels
{
@@ -16,7 +19,7 @@ namespace WalletWasabi.Fluent.ViewModels
private string _walletName = "";
private bool _optionsEnabled;
- public AddWalletPageViewModel(IScreen screen) : base(screen)
+ public AddWalletPageViewModel(IScreen screen, WalletManager walletManager, BitcoinStore store, Network network) : base(screen)
{
Title = "Add Wallet";
@@ -32,14 +35,12 @@ namespace WalletWasabi.Fluent.ViewModels
if (result is { } password)
{
- var global = Locator.Current.GetService<Global>();
-
- var walletGenerator = new WalletGenerator(global.WalletManager.WalletDirectories.WalletsDir, global.Network)
+ var walletGenerator = new WalletGenerator(walletManager.WalletDirectories.WalletsDir, network)
{
- TipHeight = global.BitcoinStore.SmartHeaderChain.TipHeight
+ TipHeight = store.SmartHeaderChain.TipHeight
};
var (km, mnemonic) = walletGenerator.GenerateWallet(WalletName, password);
- await screen.Router.Navigate.Execute(new RecoveryWordsViewModel(screen, km, mnemonic, global.WalletManager));
+ await screen.Router.Navigate.Execute(new RecoveryWordsViewModel(screen, km, mnemonic, walletManager));
}
});

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
@@ -28,7 +28,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
protected override void OnDialogClosed()
{
- _screen.Router.NavigateAndReset.Execute(new AddWalletPageViewModel(_screen));
+ _screen.Router.NavigateAndReset.Execute(new SettingsPageViewModel(_screen));
}
public void Close()

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -26,7 +26,10 @@ namespace WalletWasabi.Fluent.ViewModels
_statusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments);
var walletManager = new WalletManagerViewModel(this, global.WalletManager, global.UiConfig);
- _navBar = new NavBarViewModel(this, Router, walletManager);
+
+ var addWalletPage = new AddWalletPageViewModel(this, global.WalletManager, global.BitcoinStore, global.Network);
+
+ _navBar = new NavBarViewModel(this, Router, walletManager, addWalletPage);
}
public static MainViewModel? Instance { get; internal set; }

MODIFY
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBarViewModel.cs
@@ -25,14 +25,13 @@ namespace WalletWasabi.Fluent.ViewModels
private Action _toggleAction;
private Action _collapseOnClickAction;
- public NavBarViewModel(IScreen screen, RoutingState router, WalletManagerViewModel walletManager)
+ public NavBarViewModel(IScreen screen, RoutingState router, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage)
{
Router = router;
_walletManager = walletManager;
_topItems = new ObservableCollection<NavBarItemViewModel>();
_bottomItems = new ObservableCollection<NavBarItemViewModel>();
- var addWalletPage = new AddWalletPageViewModel(screen);
SelectedItem = new HomePageViewModel(screen, walletManager, addWalletPage);
_topItems.Add(_selectedItem);
_bottomItems.Add(addWalletPage);

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -17,7 +17,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
Title = "Settings";
- NextCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new AddWalletPageViewModel(screen)));
+ NextCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new SettingsPageViewModel(screen)));
OpenDialogCommand = ReactiveCommand.CreateFromTask(async () => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());

pass in dependencies to AddWalletPageViewModel