Use common method for clearing navigation
MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -22,9 +22,9 @@ namespace WalletWasabi.Fluent.ViewModels
{
Title = "Add Wallet";
- BackCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear());
+ BackCommand = ReactiveCommand.Create(() => ClearNavigation());
- CancelCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear());
+ CancelCommand = ReactiveCommand.Create(() => ClearNavigation());
this.WhenAnyValue(x => x.WalletName)
.Select(x => !string.IsNullOrWhiteSpace(x))

MODIFY
WalletWasabi.Fluent/ViewModels/RecoverWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/RecoverWalletPageViewModel.cs
@@ -26,16 +26,16 @@ namespace WalletWasabi.Fluent.ViewModels
.Select(x => x.Count == 12 ? new Mnemonic(GetTagsAsConcatString()) : default)
.ToProperty(this, x => x.CurrentMnemonics);
- BackCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear());
+ BackCommand = ReactiveCommand.Create(() => ClearNavigation());
NextCommand = ReactiveCommand.Create(
() =>
{
// TODO: Recover wallet, add canExecute
- navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear();
+ ClearNavigation();
});
- CancelCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear());
+ CancelCommand = ReactiveCommand.Create(() => ClearNavigation());
this.WhenAnyValue(x => x.SelectedTag)
.Where(x => !string.IsNullOrEmpty(x))

MODIFY
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
@@ -73,5 +73,20 @@ namespace WalletWasabi.Fluent.ViewModels
break;
}
}
+
+ public void ClearNavigation()
+ {
+ switch (_navigationTarget)
+ {
+ case NavigationTarget.Default:
+ case NavigationTarget.Home:
+ _navigationState.HomeScreen?.Invoke().Router.NavigationStack.Clear();
+ break;
+
+ case NavigationTarget.Dialog:
+ _navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear();
+ break;
+ }
+ }
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -17,7 +17,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
Title = "Settings";
- BackCommand = ReactiveCommand.Create(() => navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear());
+ BackCommand = ReactiveCommand.Create(() => ClearNavigation());
NextCommand = ReactiveCommand.Create(() => navigationState.HomeScreen?.Invoke().Router.Navigate.Execute(new SettingsPageViewModel(navigationState)));

Use common method for clearing navigation