Interface IRouter
Represents a router that can be used to navigate to different screens.
Namespace: Artemis.UI.Shared.Routing
Assembly: Artemis.UI.Shared.dll
Syntax
public interface IRouter
Properties
CurrentPath
Gets an observable containing the current path.
Declaration
IObservable<string?> CurrentPath { get; }
Property Value
Type | Description |
---|---|
IObservable<string> |
Routes
Gets a list of router registrations, you can use this to register new routes.
Declaration
List<IRouterRegistration> Routes { get; }
Property Value
Type | Description |
---|---|
List<IRouterRegistration> |
Methods
ClearHistory()
Clears the navigation history.
Declaration
void ClearHistory()
ClearPreviousWindowRoute()
Clears the route used by the previous window, so that it is not restored when the main window opens.
Declaration
void ClearPreviousWindowRoute()
GoBack()
Asynchronously navigates back to the previous active route.
Declaration
Task<bool> GoBack()
Returns
Type | Description |
---|---|
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.
Declaration
Task<bool> GoForward()
Returns
Type | Description |
---|---|
Task<bool> | A task containing a boolean value which indicates whether there was a forward path to go back to. |
Navigate(string, RouterNavigationOptions?)
Asynchronously navigates to the provided path.
Declaration
Task Navigate(string path, RouterNavigationOptions? options = null)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to navigate to. |
RouterNavigationOptions | options | Optional navigation options used to control navigation behaviour. |
Returns
Type | Description |
---|---|
Task | A task representing the operation |
Remarks
Navigating cancels any currently processing navigations.
SetRoot<TScreen>(RoutableHostScreen<TScreen>)
Sets the root screen from which navigation takes place.
Declaration
void SetRoot<TScreen>(RoutableHostScreen<TScreen> root) where TScreen : RoutableScreen
Parameters
Type | Name | Description |
---|---|---|
RoutableHostScreen<TScreen> | root | The root screen to set. |
Type Parameters
Name | Description |
---|---|
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.
Declaration
void SetRoot<TScreen, TParam>(RoutableHostScreen<TScreen, TParam> root) where TScreen : RoutableScreen where TParam : new()
Parameters
Type | Name | Description |
---|---|---|
RoutableHostScreen<TScreen, TParam> | root | The root screen to set. |
Type Parameters
Name | Description |
---|---|
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. |