INavigationAware interface

Namespace Runic.Navigation in Runic.Navigation 0.23.0

public interface INavigationAware

Tells content when its entry becomes its region's current entry and when it stops being current.

Remarks

Both methods are synchronous notifications of a committed change. The navigator calls them inside the model turn that commits it: after the new navigation state is applied and the departure guards' OnCommitted actions ran, and before the regions raise PropertyChanged. In that turn it first notifies the entries that stopped being current, then the entry that became current; for each entry it raises NavigationEntryContext.StateChanged before calling this interface. Nothing is called for a transition that is rejected, superseded, cancelled or fails.

The calls alternate per entry: INavigationAware.OnNavigatedTo, then INavigationAware.OnNavigatedFrom, then INavigationAware.OnNavigatedTo again when a retained entry resumes. A retained entry that retires gets no second INavigationAware.OnNavigatedFrom; its NavigationEntryContext.StateChanged reports the retirement. INavigationInitialize and INavigationResume remain the asynchronous hooks that prepare the content before the commit.

A method that throws is logged (event 1075); the commit stands and the other notifications still run. A method runs inside a model turn, so it must not block or await navigation; a navigation request it starts is admitted after the turn.

Methods

OnNavigatedFrom

void OnNavigatedFrom(NavigationExit exit)

Called when the entry stops being current: a push retains it, or a Back, BackTo, Replace, Reset or Clear retires it. When its region closes because the entry that owns the region retired, or because the navigator is disposed, it is called in the turn that clears that region, with NavigationOperation.Clear.

Parameters

exit

The entry, the operation, and whether the entry is retained or retires.

OnNavigatedTo

void OnNavigatedTo(NavigationArrival arrival)

Called when the entry becomes current: when the push, replace or reset that creates it commits, and each time a Back or BackTo resumes it. For an initial target, RunicNavigator.CreateRegion calls it with NavigationOperation.Reset before it returns, on the caller's thread.

Parameters

arrival

The entry and the operation that made it current.