mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Migrate to Prism.Avalonia.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user