INavigationRegionGuard interface

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public interface INavigationRegionGuard

Can veto a transition that departs from a whole region, independent of the entries' content: for example a guard that asks once whether to discard unsaved work anywhere in a window. Register it with NavigationRegion.AddDepartureGuard or RunicNavigator.AddDepartureGuard.

Remarks

Region guards run after the departure guards of the entries (INavigationDepartureGuard), or before them with NavigationRegionGuardOptions.Order, outside model turns, like them: one at a time, on the model's thread when the model context schedules hooks, and again when a transition reruns. A request from a region guard into its region, an ancestor or a descendant is NavigationRejection.Reentrant.

Methods

CanDepartAsync

ValueTask<bool> CanDepartAsync(NavigationRegionDeparture departure, CancellationToken cancellationToken)

Returns whether the transition may depart. false rejects it as NavigationRejection.Guard.

Parameters

departure

The departing region, its departing entries, whether one of them retires, and the operation.

cancellationToken

Cancelled when the transition is superseded, cancelled or closed.