Move default selection logic to NavBarViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -19,6 +19,8 @@ public class NavBarViewModel : ViewModelBase
TopItems = new ObservableCollection<NavBarItemViewModel>();
BottomItems = new ObservableCollection<NavBarItemViewModel>();
+ SetDefaultSelection();
+
Observable.Amb(
Wallets.ToObservableChangeSet().Transform(x => x as NavBarItemViewModel),
TopItems.ToObservableChangeSet(),
@@ -48,6 +50,16 @@ public class NavBarViewModel : ViewModelBase
public ObservableCollection<WalletViewModelBase> Wallets => UiServices.WalletManager.Wallets;
+ private void SetDefaultSelection()
+ {
+ var walletToSelect = Wallets.FirstOrDefault(item => item.WalletName == Services.UiConfig.LastSelectedWallet) ?? Wallets.FirstOrDefault();
+
+ if (walletToSelect is { } && walletToSelect.OpenCommand.CanExecute(default))
+ {
+ walletToSelect.OpenCommand.Execute(default);
+ }
+ }
+
public async Task InitialiseAsync()
{
var topItems = NavigationManager.MetaData.Where(x => x.NavBarPosition == NavBarPosition.Top);

MODIFY
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
WalletWasabi.Fluent/ViewModels/WalletManagerViewModel.cs
@@ -187,13 +187,6 @@ public partial class WalletManagerViewModel : ViewModelBase
{
InsertWallet(ClosedWalletViewModel.Create(wallet));
}
-
- var walletToSelect = Wallets.FirstOrDefault(item => item.WalletName == Services.UiConfig.LastSelectedWallet) ?? Wallets.FirstOrDefault();
-
- if (walletToSelect is { } && walletToSelect.OpenCommand.CanExecute(default))
- {
- walletToSelect.OpenCommand.Execute(default);
- }
}
private bool TryGetWalletViewModel(Wallet wallet, [NotNullWhen(true)] out WalletViewModelBase? walletViewModel)

Move default selection logic to NavBarViewModel