[TUI] Migrate to Prism.Avalonia.

This commit is contained in:
2025-11-18 04:36:49 +00:00
parent 31dfcadab8
commit b580bf0555
17 changed files with 901 additions and 755 deletions

View File

@@ -29,4 +29,30 @@ using CommunityToolkit.Mvvm.ComponentModel;
namespace Aaru.Tui.ViewModels;
public class ViewModelBase : ObservableObject;
public class ViewModelBase : ObservableObject, IRegionAware
{
/// <summary>
/// Called to determine if this instance can handle the navigation request.
/// Don't call this directly, use <seealso cref="OnNavigatingTo(NavigationContext)" />.
/// </summary>
/// <param name="navigationContext">The navigation context.</param>
/// <returns><see langword="true" /> if this instance accepts the navigation request; otherwise, <see langword="false" />.</returns>
public virtual bool IsNavigationTarget(NavigationContext navigationContext) =>
// Auto-allow navigation
OnNavigatingTo(navigationContext);
/// <summary>Called when the implementer is being navigated away from.</summary>
/// <param name="navigationContext">The navigation context.</param>
public virtual void OnNavigatedFrom(NavigationContext navigationContext) {}
/// <summary>Called when the implementer has been navigated to.</summary>
/// <param name="navigationContext">The navigation context.</param>
public virtual void OnNavigatedTo(NavigationContext navigationContext) {}
/// <summary>Navigation validation checker.</summary>
/// <remarks>Override for Prism 7.2's IsNavigationTarget.</remarks>
/// <param name="navigationContext">The navigation context.</param>
/// <returns><see langword="true" /> if this instance accepts the navigation request; otherwise, <see langword="false" />.</returns>
public virtual bool OnNavigatingTo(NavigationContext navigationContext) => true;
}