UI Tookit UI Tookit
UI Tookit UI Tookit
DocFX + Singulink = ♥

Search Results for

    Class NavigatorCore

    Provides the base implementation of a navigator that manages route-based navigation with a hierarchy of views.

    Inheritance
    object
    NavigatorCore
    TestNavigator
    Navigator
    Implements
    INavigator
    IDialogPresenter
    INotifyPropertyChanged
    Namespace: Singulink.UI.Navigation
    Assembly: Singulink.UI.Navigation.dll
    Syntax
    public abstract class NavigatorCore : INavigator, IDialogPresenter, INotifyPropertyChanged

    Constructors

    Name Description
    NavigatorCore(object, ITaskRunner, NavigatorBuilderCore)

    Initializes a new instance of the NavigatorCore class.

    Properties

    Name Description
    CanGoBack

    Gets a value indicating whether the navigator can navigate back to the previous view. This property can be used to bind the enabled state of a back button in the UI and should be checked before calling GoBackAsync().

    CanGoForward

    Gets a value indicating whether the navigator can navigate forward to the next view. This property can be used to bind the enabled state of a forward button in the UI and should be checked before calling GoForwardAsync().

    CanMaybeShutDownNow

    Gets a value indicating whether the navigator is currently in a state where TryShutDownAsync() could begin without immediately returning false due to busy state. This does not run any view model lifecycle methods, so view models that would cancel a navigation away can still cause an actual shutdown attempt to fail. Useful for synchronous host hooks (e.g. WebAssembly beforeunload) where awaiting is not possible.

    CanRefresh

    Gets a value indicating whether the navigator can refresh the current view. This property can be used to bind the enabled state of a refresh button or "pull to refresh" feature in the UI and should be checked before calling RefreshAsync().

    CanShowDialog

    Gets a value indicating whether this presenter can currently show a dialog. This is false for a navigator while any dialog is showing, for a dialog navigator whose dialog is not the top showing dialog, and for any presenter while showing dialogs is blocked (e.g. during navigation lifecycle methods that do not permit dialogs).

    CurrentRoute

    Gets information about the current route, including the path and options.

    HasBackHistory

    Gets a value indicating whether the navigator has back history.

    HasForwardHistory

    Gets a value indicating whether the navigator has forward history.

    IsNavigating

    Gets a value indicating whether the navigator is currently in the process of navigating to a new view.

    IsRedirecting

    Gets a value indicating whether the current navigation is occurring as part of a redirect from another navigation.

    IsShowingDialog

    Gets a value indicating whether the navigator is currently showing a dialog.

    RootServices

    Gets the root service provider. This property can be accessed from any thread.

    TaskRunner

    Gets the task runner for this presenter. This property can be accessed from any thread.

    Methods

    Name Description
    CaptureDialogFocusState()

    Captures the current focus state before a child dialog is shown so it can be restored to the parent dialog when the child closes. The returned object is opaque to the navigator and is passed back to RestoreDialogFocusState(object, object?). The default implementation returns null.

    ClearHistoryAsync()

    Clears back and forward navigation history.

    CloseLightDismissPopups()

    Closes any light-dismiss popups that are currently open.

    CreateDefaultDialog(Type)

    Creates a framework dialog object for a dialog view model type that has no registered dialog mapping, or returns null if no default is available (in which case showing the dialog throws). The default implementation returns null.

    CreateDialogViewModel<TViewModel>(params object?[])

    Creates a dialog view model with constructor injection, the same way the navigator creates routed view models. Explicit arguments are matched to constructor parameters by type (positionally among parameters of the same type); remaining parameters are resolved from child services registered by the dialogs this presenter is nested in and by the active route's view models (nearest first), then from RootServices, then from parameter default values. The view model's Navigator is available inside its constructor.

    CurrentPathStartsWith(ConcreteRoute)

    Determines whether the current route path starts with the same path as the specified route.

    CurrentPathStartsWith(IConcreteRootRoutePart)

    Determines whether the current route path starts with the same path as the specified root route part.

    CurrentRouteHasParent<TViewModel>()

    Determines whether the current route contains a parent view with the specified view model type.

    EnsureThreadAccess()

    Ensures that the current call is happening on the required thread.

    GetBackStack()

    Returns the routes that are in the back navigation stack, ordered from the most recent to the oldest. Does not include the current route.

    GetCurrentRoutePartsToParent(Type)

    Gets the current route parts up to the specified parent view model type.

    GetForwardStack()

    Returns a list of routes currently in the forward navigation stack. Does not include the current route.

    GoBackAsync()

    Navigates back to the previous view.

    GoForwardAsync()

    Navigates forward to the next view.

    HandleSystemBackRequest()

    Handles a system back request, such as when the user presses the back button on a mobile device, a hardware back button on a desktop or the back button in a web browser. Returns true if there is a dialog showing, a light dismiss popup was closed, a navigation is currently in progress or if a back navigation was initiated; otherwise false (meaning there was no back history).

    HandleSystemForwardRequest()

    Handles a system forward request, such as when the user presses the forward button on a mobile device, a hardware forward button on a desktop or the forward button in a web browser. Returns true if there is a dialog showing, a navigation is currently in progress or if a forward navigation was initiated; otherwise false (meaning there was no forward history).

    HideDialog(object)

    Hides the specified framework dialog object.

    NavigateAsync(ConcreteRoute, string?)

    Navigates to the specified route.

    NavigateAsync(IConcreteRootRoutePart, string?)

    Navigates to the specified root route.

    NavigateAsync(NavigatorRoute)

    Navigates to the specified route, including its anchor. This can be used to return to a route that was previously obtained from CurrentRoute, the navigation stacks or a RoutePin.

    NavigateAsync(string)

    Navigates to the specified route.

    NavigatePartialAsync(string?)

    Navigates to a partial route that has the same path as the current route but with the specified options.

    NavigatePartialAsync<TParentViewModel>(ConcretePartialRoute<TParentViewModel>, string?)

    Navigates to the specified partial route beneath the parent view model type in the current route. The current route must contain a view with the specified parent view model type otherwise an InvalidOperationException is thrown.

    NavigatePartialAsync<TParentViewModel>(IConcreteChildRoutePart<TParentViewModel>, string?)

    Navigates to the specified child route beneath the parent view model type in the current route. The current route must contain a view with the specified parent view model type otherwise an InvalidOperationException is thrown.

    NavigateToParentAsync<TParentViewModel>(string?)

    Navigates to the parent view in the current route that has the specified view model type.

    OnCurrentRouteChanged(NavigatorRoute)

    Called when the current route changes.

    OnLayerCoveredChanged(object?, bool)

    Called when a layer (the root view or a dialog) becomes covered by a child dialog, or is uncovered again when the child dialog closes. Implementations can use this to adjust how the layer is presented while it is covered (e.g. to avoid showing it as disabled underneath the child dialog while it is busy, since the child dialog is what blocks interaction with it). The default implementation does nothing.

    OnNavigationCompleted(NavigationType, NavigatorRoute, NavigationResult, object?)

    Called when a navigation completes, either successfully or due to cancellation. This is always called if OnNavigationStarting(NavigationType, NavigatorRoute) was called for the same navigation.

    OnNavigationRedirecting(IRoutedViewModelBase, Redirect)

    Called when a routed view model requested a redirect during navigation, immediately before the redirect is executed. The default implementation does nothing.

    OnNavigationStarting(NavigationType, NavigatorRoute)

    Called synchronously at the start of a navigation, before any view model lifecycle methods are invoked and before any awaits occur. Implementations should perform any synchronous work required at the start of a navigation, such as updating browser history state on WebAssembly platforms (which must happen synchronously while user activation is still valid).

    OnShutDown()

    Called once on the UI thread after a successful TryShutDownAsync() has torn down the navigator. Implementations should release any resources tied to the navigator instance (e.g. unsubscribe from system event handlers) so the instance can be garbage collected and a new navigator can be hooked in its place.

    OnViewModelLifecycleInvoking(IRoutedViewModelBase, ViewModelLifecycleStage)

    Called immediately before a lifecycle method is invoked on a routed view model during navigation. The default implementation does nothing.

    PinCurrentRoute()

    Pins the current route so that its views and view models are retained (regardless of caching settings and whether the route remains in the navigation history) until the returned pin is disposed. Navigating to the pinned route again with NavigateAsync(NavigatorRoute) reuses them with their state intact, which is useful for temporarily leaving a view with unsaved state and returning to it later.

    RefreshAsync()

    Refreshes the current route.

    RestoreDialogFocusState(object, object?)

    Restores focus into the specified framework dialog object after a child dialog closes. Implementations should defer the restoration until after any focus handling the framework performs when a dialog closes, and should ensure focus ends up inside the dialog even if focusState is null or no longer applicable. The default implementation does nothing.

    SetActiveView(object, object?)

    Sets the active view in the specified view navigator.

    ShowDialogAsync(IDialogViewModel)

    Shows a dialog with the specified view model and returns a task that completes when the dialog closes.

    ShowDialogAsync<TResult>(IDialogViewModel<TResult>)

    Shows a dialog with the specified view model and returns a task that completes with the dialog result when the dialog closes.

    StartShowingDialog(object)

    Starts showing the specified framework dialog object. This is invoked in a fire-and-forget manner; awaiting completion of the dialog is handled by the core orchestration via the dialog's TaskCompletionSource.

    TryDismissTopDialog()

    Tries to dismiss the top-most dialog if it is dismissible and its task runner is not currently busy.

    TryGetTopDialog()

    Returns the dialog navigator and view model for the top showing dialog, or null if no dialog is currently showing.

    TryShutDownAsync()

    Shuts down the navigator by releasing all views and view model resources. Returns false if shutdown, navigation or busy tasks are in progress, dialogs are showing, or any view models are preventing navigating away from the current view; otherwise returns true after successfully shutting down.

    TryShutDownProbeAsync()

    Runs only the cancellable "navigating away" voting phase of a full shutdown by invoking OnNavigatingAwayAsync / OnRouteNavigatingAsync on each currently navigated-to route item. Returns true if no view model cancelled, otherwise false. Performs no teardown so it is safe to use as a non-destructive probe (e.g. for the WebAssembly beforeunload event). Returns a faulted/false task without starting any work if CanMaybeShutDownNow is false. The navigator is marked busy synchronously and unmarked when the returned task completes, regardless of whether the caller awaits it, so it is safe to call from synchronous host event handlers.

    UpdateCurrentRoute(IConcreteRoutePart, string?)

    Updates the last route part of the current route in-place without triggering any navigation lifecycle events. The new route part must have a view model type that matches the last route part of the current route. This is useful when a route changes in response to an action (e.g. a form submission that creates a new entry and transitions from a "new-entry" to an "entry/{id}" route) without causing a full navigation.

    UpdateCurrentRoute(string?)

    Updates the current route in-place without triggering any navigation lifecycle events. This is useful for updating the anchor or other options in response to UI state changes (e.g. selected item in a list) without causing a full navigation.

    WireDialog(object, IDialogViewModel, out ITaskRunner)

    Wires up a newly created framework-specific dialog object with the specified view model. The implementation should attach the view model as the dialog's data context, hook up any framework-specific bindings/event handlers, and produce a task runner used to run dialog operations.

    WireView(object, IRoutedViewModelBase, out object?)

    Wires up a newly materialized view with the specified view model. The implementation should attach the view model as the view's data context, hook up any framework-specific bindings/event handlers, and produce the child view navigator if the view is a parent view.

    Events

    Name Description
    PropertyChanged

    Occurs when a property value changes.

    Extension Methods

    DialogPresenterExtensions.ShowMessageDialogAsync(IDialogPresenter, MessageDialogOptions)
    DialogPresenterExtensions.ShowMessageDialogAsync(IDialogPresenter, string)
    DialogPresenterExtensions.ShowMessageDialogAsync(IDialogPresenter, string, IEnumerable<string>)
    DialogPresenterExtensions.ShowMessageDialogAsync(IDialogPresenter, string, string)
    DialogPresenterExtensions.ShowMessageDialogAsync(IDialogPresenter, string, string, IEnumerable<string>)
    © Singulink. All rights reserved.