Table of Contents

Interface IRouter

Namespace
Artemis.UI.Shared.Routing
Assembly
Artemis.UI.Shared.dll

Represents a router that can be used to navigate to different screens.

public interface IRouter

Properties

CurrentPath

Gets an observable containing the current path.

IObservable<string?> CurrentPath { get; }

Property Value

IObservable<string>

Routes

Gets a list of router registrations, you can use this to register new routes.

List<IRouterRegistration> Routes { get; }

Property Value

List<IRouterRegistration>

Methods

ClearHistory()

Clears the navigation history.

void ClearHistory()

ClearPreviousWindowRoute()

Clears the route used by the previous window, so that it is not restored when the main window opens.

void ClearPreviousWindowRoute()

GoBack()

Asynchronously navigates back to the previous active route.

Task<bool> GoBack()

Returns

Task<bool>

A task containing a boolean value which indicates whether there was a previous path to go back to.

GoForward()

Asynchronously navigates forward to the previous active route.

Task<bool> GoForward()

Returns

Task<bool>

A task containing a boolean value which indicates whether there was a forward path to go back to.

GoUp(RouterNavigationOptions?)

Asynchronously navigates upwards to the parent route.

Task<bool> GoUp(RouterNavigationOptions? options = null)

Parameters

options RouterNavigationOptions

Returns

Task<bool>

Navigate(string, RouterNavigationOptions?)

Asynchronously navigates to the provided path.

Task Navigate(string path, RouterNavigationOptions? options = null)

Parameters

path string

The path to navigate to.

options RouterNavigationOptions

Optional navigation options used to control navigation behaviour.

Returns

Task

A task representing the operation

Remarks

Navigating cancels any currently processing navigations.

Reload()

Asynchronously reloads the current route

Task Reload()

Returns

Task

A task representing the operation

SetRoot<TScreen>(RoutableHostScreen<TScreen>)

Sets the root screen from which navigation takes place.

void SetRoot<TScreen>(RoutableHostScreen<TScreen> root) where TScreen : RoutableScreen

Parameters

root RoutableHostScreen<TScreen>

The root screen to set.

Type Parameters

TScreen

The type of the root screen. It must be a class.

SetRoot<TScreen, TParam>(RoutableHostScreen<TScreen, TParam>)

Sets the root screen from which navigation takes place.

void SetRoot<TScreen, TParam>(RoutableHostScreen<TScreen, TParam> root) where TScreen : RoutableScreen where TParam : new()

Parameters

root RoutableHostScreen<TScreen, TParam>

The root screen to set.

Type Parameters

TScreen

The type of the root screen. It must be a class.

TParam

The type of the parameters for the root screen. It must have a parameterless constructor.