add basic interfaces for navigation management.
ADD
WalletWasabi.Fluent/ViewModels/Navigation/INavigatable.cs
+namespace WalletWasabi.Fluent.ViewModels.Navigation
+{
+ public interface INavigatable
+ {
+ void OnNavigatedTo();
+
+ void OnNavigatedFrom();
+ }
+}
\ No newline at end of file

ADD
WalletWasabi.Fluent/ViewModels/Navigation/INavigationManager.cs
+using System;
+
+namespace WalletWasabi.Fluent.ViewModels.Navigation
+{
+ public interface INavigationManager
+ {
+ /// <summary>
+ /// The Current Page.
+ /// </summary>
+ INavigatable CurrentPage { get; }
+
+ /// <summary>
+ /// The Previous Page.
+ /// </summary>
+ INavigatable PreviousPage { get; }
+
+ /// <summary>
+ /// True if you can navigate back, else false.
+ /// </summary>
+ bool CanNavigateBack { get; }
+
+ void Navigate(INavigatable viewmodel, NavigationMode mode = NavigationMode.Normal);
+
+ void Back();
+
+ void Back(Type pageType);
+ }
+}
\ No newline at end of file

ADD
WalletWasabi.Fluent/ViewModels/Navigation/NavigationMode.cs
+namespace WalletWasabi.Fluent.ViewModels.Navigation
+{
+ public enum NavigationMode
+ {
+ /// <summary>
+ /// Navigates to another page with the current page saved on the stack.
+ /// </summary>
+ Normal,
+
+ /// <summary>
+ /// Navigates to another page without changing the stack.
+ /// </summary>
+ Skip,
+
+ /// <summary>
+ /// Navigates to another page replacing the current page on the stack.
+ /// </summary>
+ Swap,
+
+ /// <summary>
+ /// Navigates to another page and clears the stack. The back button will not be available after this.
+ /// </summary>
+ Clear
+ }
+}
\ No newline at end of file

ADD
WalletWasabi.Fluent/ViewModels/Navigation/NavigationStack.cs
+using System;
+using System.Collections.Generic;
+using ReactiveUI;
+
+namespace WalletWasabi.Fluent.ViewModels.Navigation
+{
+ public class NavigationStack : ReactiveObject, INavigationManager
+ {
+ private readonly Stack<INavigatable> _backStack;
+ private INavigatable _currentPage;
+ private INavigatable _previousPage;
+ private bool _canNavigateBack;
+
+ public NavigationStack()
+ {
+ _backStack = new Stack<INavigatable>();
+ }
+
+ public INavigatable CurrentPage
+ {
+ get => _currentPage;
+ set => this.RaiseAndSetIfChanged(ref _currentPage, value);
+ }
+
+ public INavigatable PreviousPage
+ {
+ get => _previousPage;
+ set => this.RaiseAndSetIfChanged(ref _previousPage, value);
+ }
+
+ public bool CanNavigateBack
+ {
+ get => _canNavigateBack;
+ set => this.RaiseAndSetIfChanged(ref _canNavigateBack, value);
+ }
+
+ public void Navigate(INavigatable viewmodel, NavigationMode mode = NavigationMode.Normal)
+ {
+ switch (mode)
+ {
+ case NavigationMode.Normal:
+ if (CurrentPage is { })
+ {
+ _backStack.Push(CurrentPage);
+
+ CurrentPage = viewmodel;
+ }
+ break;
+
+ case NavigationMode.Clear:
+ break;
+
+ case NavigationMode.Skip:
+ break;
+
+ case NavigationMode.Swap:
+ break;
+ }
+
+ UpdateCanNavigateBack();
+ }
+
+ public void Back()
+ {
+ if (CanNavigateBack)
+ {
+ var oldPage = CurrentPage;
+
+ CurrentPage = _backStack.Pop();
+ }
+ }
+
+ public void Back(Type pageType)
+ {
+ throw new NotImplementedException();
+ }
+
+ private void UpdateCanNavigateBack()
+ {
+ CanNavigateBack = _backStack.Count > 0;
+ }
+ }
+}
\ No newline at end of file

add basic interfaces for navigation management.