Fix search page results navigation
MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -16,7 +16,6 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
{
private ObservableCollection<NavBarItemViewModel> _topItems;
private ObservableCollection<NavBarItemViewModel> _bottomItems;
- private NavBarItemViewModel? _searchPage;
private NavBarItemViewModel? _selectedItem;
private readonly WalletManagerViewModel _walletManager;
private bool _isBackButtonVisible;
@@ -32,12 +31,15 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
_topItems = new ObservableCollection<NavBarItemViewModel>();
_bottomItems = new ObservableCollection<NavBarItemViewModel>();
- SearchPage = new SearchPageViewModel(navigationState, walletManager, addWalletPage);
+ var homePage = new HomePageViewModel(navigationState, walletManager, addWalletPage);
+ var settingsPage = new SettingsPageViewModel(navigationState);
+ var searchPage = new SearchPageViewModel(navigationState, walletManager, addWalletPage, settingsPage, homePage);
+
+ SelectedItem = homePage;
- SelectedItem = new HomePageViewModel(navigationState, walletManager, addWalletPage);
_topItems.Add(SelectedItem);
- _bottomItems.Add(SearchPage);
- _bottomItems.Add(new SettingsPageViewModel(navigationState));
+ _bottomItems.Add(searchPage);
+ _bottomItems.Add(settingsPage);
_bottomItems.Add(addWalletPage);
Router.CurrentViewModel
@@ -95,12 +97,6 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
set => this.RaiseAndSetIfChanged(ref _bottomItems, value);
}
- public NavBarItemViewModel? SearchPage
- {
- get => _searchPage;
- set => this.RaiseAndSetIfChanged(ref _searchPage, value);
- }
-
public NavBarItemViewModel? SelectedItem
{
get => _selectedItem;

MODIFY
WalletWasabi.Fluent/ViewModels/SearchPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SearchPageViewModel.cs
@@ -16,7 +16,7 @@ namespace WalletWasabi.Fluent.ViewModels
private readonly ReadOnlyObservableCollection<SearchResult> _searchResults;
private string? _searchQuery;
- public SearchPageViewModel(NavigationStateViewModel navigationState, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(navigationState, NavigationTarget.HomeScreen)
+ public SearchPageViewModel(NavigationStateViewModel navigationState, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage, SettingsPageViewModel settingsPage, HomePageViewModel homePage) : base(navigationState, NavigationTarget.HomeScreen)
{
Title = "Search";
@@ -25,10 +25,10 @@ namespace WalletWasabi.Fluent.ViewModels
var walletCategory = new SearchCategory("Wallets", 1);
searchItems.Add(
- CreateHomeSearchItem(generalCategory, 0, walletManager, addWalletPage));
+ CreateHomeSearchItem(generalCategory, 0, homePage));
searchItems.Add(
- CreateSettingsSearchItem(generalCategory, 1));
+ CreateSettingsSearchItem(generalCategory, 1, settingsPage));
searchItems.Add(
CreateAddWalletSearchItem(generalCategory, 2, addWalletPage));
@@ -75,7 +75,7 @@ namespace WalletWasabi.Fluent.ViewModels
};
}
- private SearchItemViewModel CreateHomeSearchItem(SearchCategory category, int order, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage)
+ private SearchItemViewModel CreateHomeSearchItem(SearchCategory category, int order, HomePageViewModel homePage)
{
return new(
title: "Home",
@@ -86,10 +86,10 @@ namespace WalletWasabi.Fluent.ViewModels
iconName: "home_regular",
navigationState: NavigationState,
navigationTarget: NavigationTarget.HomeScreen,
- createTargetView: () => new HomePageViewModel(NavigationState, walletManager, addWalletPage));
+ createTargetView: () => homePage);
}
- private SearchItemViewModel CreateSettingsSearchItem(SearchCategory category, int order)
+ private SearchItemViewModel CreateSettingsSearchItem(SearchCategory category, int order, SettingsPageViewModel settingsPage)
{
return new(
title: "Settings",
@@ -100,7 +100,7 @@ namespace WalletWasabi.Fluent.ViewModels
iconName: "settings_regular",
navigationState: NavigationState,
navigationTarget: NavigationTarget.HomeScreen,
- createTargetView: () => new SettingsPageViewModel(NavigationState));
+ createTargetView: () => settingsPage);
}
private SearchItemViewModel CreateAddWalletSearchItem(SearchCategory category, int order, AddWalletPageViewModel addWalletPage)

Fix search page results navigation