Use navigation state
MODIFY
WalletWasabi.Fluent/ViewModels/ClosedWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/ClosedWalletViewModel.cs
@@ -19,7 +19,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
_items = new ObservableCollection<NavBarItemViewModel>
{
- new SettingsPageViewModel(screen) { Parent = this }
+ new SettingsPageViewModel(navigationState) { Parent = this }
};
OpenWalletCommand = ReactiveCommand.CreateFromTask(

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -36,7 +36,7 @@ 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);
+ var walletManager = new WalletManagerViewModel(_navigationState, global.WalletManager, global.UiConfig);
_navBar = new NavBarViewModel(_navigationState, Router, walletManager);
}

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -23,7 +23,7 @@ namespace WalletWasabi.Fluent.ViewModels
OpenDialogCommand = ReactiveCommand.CreateFromTask(async () => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());
- OpenDialogScreenCommand = ReactiveCommand.Create(() => navigationState.DialogScreen().Router.Navigate.Execute(new HomePageViewModel(navigationState)));
+ OpenDialogScreenCommand = ReactiveCommand.Create(() => navigationState.DialogScreen().Router.Navigate.Execute(new AddWalletPageViewModel(navigationState)));
ConfirmSetting = new Interaction<string, bool>();

MODIFY
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
@@ -18,15 +18,15 @@ namespace WalletWasabi.Fluent.ViewModels
private WalletViewModelBase _selectedItem;
private ObservableCollection<WalletViewModelBase> _items;
private readonly Dictionary<Wallet, WalletViewModelBase> _walletDictionary;
- private readonly IScreen _screen;
+ private readonly NavigationStateViewModel _navigationState;
private bool _anyWalletStarted;
- public WalletManagerViewModel(IScreen screen, WalletManager walletManager, UiConfig uiConfig)
+ public WalletManagerViewModel(NavigationStateViewModel navigationState, WalletManager walletManager, UiConfig uiConfig)
{
Model = walletManager;
_walletDictionary = new Dictionary<Wallet, WalletViewModelBase>();
_items = new ObservableCollection<WalletViewModelBase>();
- _screen = screen;
+ _navigationState = navigationState;
Observable
.FromEventPattern<WalletState>(walletManager, nameof(WalletManager.WalletStateChanged))
@@ -58,8 +58,8 @@ namespace WalletWasabi.Fluent.ViewModels
.Subscribe(wallet =>
{
WalletViewModelBase vm = (wallet.State <= WalletState.Starting)
- ? ClosedWalletViewModel.Create(screen, walletManager, wallet)
- : WalletViewModel.Create(screen, uiConfig, wallet);
+ ? ClosedWalletViewModel.Create(_navigationState, walletManager, wallet)
+ : WalletViewModel.Create(_navigationState, uiConfig, wallet);
InsertWallet(vm);
});
@@ -108,7 +108,7 @@ namespace WalletWasabi.Fluent.ViewModels
throw new Exception("Wallet already opened.");
}
- var walletViewModel = WalletViewModel.Create(_screen, uiConfig, wallet);
+ var walletViewModel = WalletViewModel.Create(_navigationState, uiConfig, wallet);
InsertWallet(walletViewModel);
@@ -140,7 +140,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
foreach (var wallet in walletManager.GetWallets())
{
- InsertWallet(ClosedWalletViewModel.Create(_screen, walletManager, wallet));
+ InsertWallet(ClosedWalletViewModel.Create(_navigationState, walletManager, wallet));
}
}
}

Use navigation state