add a default target...
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
@@ -75,6 +75,8 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}
+ public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
+
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
@@ -13,7 +13,11 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
protected NavBarItemViewModel(NavigationStateViewModel navigationState) : base(navigationState)
{
_title = "";
- OpenCommand = ReactiveCommand.Create(NavigateToSelf);
+ OpenCommand = ReactiveCommand.Create(
+ () =>
+ {
+ NavigateToSelf();
+ });
}
public NavBarItemViewModel? Parent { get; set; }

MODIFY
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/Navigation/RoutableViewModel.cs
@@ -4,7 +4,6 @@ using System.Linq;
using System.Reactive.Disposables;
using System.Threading.Tasks;
using System.Windows.Input;
-using Microsoft.AspNetCore.Routing;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Gui.ViewModels;
@@ -16,6 +15,8 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
private bool _isBusy;
public NavigationTarget CurrentTarget { get; private set; }
+ public virtual NavigationTarget DefaultTarget => NavigationTarget.HomeScreen;
+
protected RoutableViewModel(NavigationStateViewModel navigationState)
{
NavigationState = navigationState;
@@ -70,6 +71,11 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
public IDisposable NavigateTo(RoutableViewModel viewModel, NavigationTarget navigationTarget, bool resetNavigation = false)
{
+ if (navigationTarget == NavigationTarget.Default)
+ {
+ navigationTarget = DefaultTarget;
+ }
+
switch (navigationTarget)
{
case NavigationTarget.Default:
@@ -156,6 +162,8 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
}
}
+ public void NavigateToSelf() => NavigateToSelf(NavigationTarget.Default);
+
public void NavigateToSelf(NavigationTarget target) => NavigateTo(this, target, resetNavigation: false);
public void NavigateToSelfAndReset(NavigationTarget target) => NavigateTo(this, target, resetNavigation: true);
@@ -166,7 +174,6 @@ namespace WalletWasabi.Fluent.ViewModels.Navigation
switch (CurrentTarget)
{
- case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
router = NavigationState.HomeScreen.Invoke().Router;
break;

add a default target...