public sealed class NavigationEntryContext Gives an entry's hooks its identity, retirement signal, model context and late-completion operations.
Properties
ModelContext
public IRunicModelContext ModelContext { get; } Gets the model context that commits navigation state.
Retirement
public CancellationToken Retirement { get; } Gets a token that is cancelled when the entry starts retiring.
Services
public IServiceProvider Services { get; } Gets the entry's service provider: its own service scope when the navigator created one (RunicNavigatorOptions.CreateEntryScopes), otherwise the navigator's RunicNavigator.Services, otherwise an empty provider. It is the provider INavigationEntry.Services returns. After an entry with its own scope retires, resolving from it throws ObjectDisposedException.
Methods
BackAsync
public ValueTask<NavigationResult<object>> BackAsync(CancellationToken cancellationToken = default) Goes back from this entry. The request expects this entry to be current, so a retained or retired entry receives NavigationRejection.NotCurrent.
CompleteAsync
public ValueTask<NavigationResult<object>> CompleteAsync<TResult>(TResult result, CancellationToken cancellationToken = default) Completes the NavigationRegion.PushForResult request that pushed this entry and goes back from it, like NavigationEntryContext.BackAsync. When this entry is the region's only entry, going back leaves the region empty. The request's completion becomes Completed with result only if that back transition commits; otherwise the entry stays current, the request stays open, and the call can be repeated. When the request was already dismissed, the entry still goes back and the result is dropped.
Type parameters
TResultThe request's result type, or any type whose value is a result-type value at run time, such as
Booleanfor abool?request orInt32for anObjectrequest.
Parameters
resultThe result.
cancellationTokenCancels the back transition before it commits.
Exceptions
InvalidOperationExceptionThe entry was not pushed with
PushForResult, orresultis not a value of its result type.
DismissAsync
public ValueTask<NavigationResult<object>> DismissAsync(CancellationToken cancellationToken = default) Leaves this entry without a result. What happens depends on the entry's state:
- Current, pushed with
NavigationRegion.PushForResult: the request endsDismissedat once, then the entry goes back likeNavigationEntryContext.CompleteAsync, which may leave the region empty. This is the path of a cancelled caller token: if that Back is rejected, the request stays dismissed and the entry stays. - Current, without an open result request: goes back from the entry, which may leave the region empty.
- Pending, because the push that creates it has not committed (for example, called from its own
INavigationInitialize.InitializeAsync): dismisses its request, cancels that push, which endsNavigationRejection.Cancelled, and returns that rejection at once without awaiting the push. The hook's token is cancelled. - Retained: dismisses its request and leaves the entry in place. Returns
NavigationRejection.NotCurrent. - Retiring or retired: does nothing. Returns
NavigationRejection.NotCurrent.
Parameters
cancellationTokenCancels the Back before it commits. The dismissal of the request is not undone.