Register navbar items
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -24,8 +24,6 @@ namespace WalletWasabi.Fluent.ViewModels
private DialogViewModelBase? _currentDialog;
private DialogScreenViewModel _dialogScreen;
private NavBarViewModel _navBar;
- private readonly HomePageViewModel _homePage;
- private readonly SearchPageViewModel _searchPage;
private bool _isMainContentEnabled;
private bool _isDialogScreenEnabled;
@@ -56,21 +54,26 @@ namespace WalletWasabi.Fluent.ViewModels
var privacyMode = new PrivacyModeViewModel(global.UiConfig);
- _homePage = new HomePageViewModel(walletManager, addWalletPage);
+ var homePage = new HomePageViewModel(walletManager, addWalletPage);
- _searchPage = new SearchPageViewModel(walletManager);
+ var searchPage = new SearchPageViewModel(walletManager);
- _navBar = new NavBarViewModel(MainScreen, _homePage, _searchPage, walletManager, addWalletPage, settingsPage, privacyMode);
+ _navBar = new NavBarViewModel(MainScreen, walletManager);
- RegisterCategories(_searchPage);
+ _navBar.RegisterTopItem(homePage);
+ _navBar.RegisterBottomItem(searchPage);
+ _navBar.RegisterBottomItem(privacyMode);
+ _navBar.RegisterBottomItem(addWalletPage);
+ _navBar.RegisterBottomItem(settingsPage);
- RegisterRootEntries(_searchPage, _homePage, settingsPage, addWalletPage);
+ RegisterCategories(searchPage);
+ RegisterRootEntries(searchPage, homePage, settingsPage, addWalletPage);
+ RegisterEntries(searchPage, global.LegalDocuments);
+ RegisterSettingsSearchItems(searchPage, settingsPage);
- RegisterEntries(_searchPage, global.LegalDocuments);
+ searchPage.Initialise();
- RegisterSettingsSearchItems(_searchPage, settingsPage);
-
- _searchPage.Initialise();
+ MainScreen.To(homePage);
this.WhenAnyValue(x => x.DialogScreen!.IsDialogOpen)
.ObserveOn(RxApp.MainThreadScheduler)
@@ -161,7 +164,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
var content = await File.ReadAllTextAsync(legalDocuments.FilePath);
- var legalDocs = new LegalDocumentsViewModel(content, backOnNext: true);
+ var legalDocs = new LegalDocumentsViewModel(content, backOnNext: false);
return legalDocs;
});

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -30,28 +30,12 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
private Action? _toggleAction;
private Action? _collapseOnClickAction;
- public NavBarViewModel(
- TargettedNavigationStack mainScreen,
- HomePageViewModel homePage,
- SearchPageViewModel searchPage,
- WalletManagerViewModel walletManager,
- AddWalletPageViewModel addWalletPage,
- SettingsPageViewModel settingsPage,
- PrivacyModeViewModel privacyMode)
+ public NavBarViewModel(TargettedNavigationStack mainScreen, WalletManagerViewModel walletManager)
{
_walletManager = walletManager;
_topItems = new ObservableCollection<NavBarItemViewModel>();
_bottomItems = new ObservableCollection<NavBarItemViewModel>();
- _selectedItem = homePage;
-
- _topItems.Add(_selectedItem);
-
- _bottomItems.Add(searchPage);
- _bottomItems.Add(privacyMode);
- _bottomItems.Add(addWalletPage);
- _bottomItems.Add(settingsPage);
-
mainScreen.WhenAnyValue(x => x.CurrentPage)
.OfType<NavBarItemViewModel>()
.Subscribe(x => CurrentPageChanged(x, walletManager));
@@ -68,8 +52,6 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
SelectedItem.IsExpanded = x;
}
});
-
- mainScreen.To(homePage);
}
public ObservableCollection<NavBarItemViewModel> TopItems
@@ -116,6 +98,26 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
set => this.RaiseAndSetIfChanged(ref _isOpen, value);
}
+ public void RegisterTopItem(NavBarItemViewModel item, bool isSelected = false)
+ {
+ _topItems.Add(item);
+
+ if (isSelected)
+ {
+ _selectedItem = item;
+ }
+ }
+
+ public void RegisterBottomItem(NavBarItemViewModel item, bool isSelected = false)
+ {
+ _bottomItems.Add(item);
+
+ if (isSelected)
+ {
+ _selectedItem = item;
+ }
+ }
+
public void DoToggleAction()
{
ToggleAction?.Invoke();

Register navbar items