Interface IViewRouter
Top-level router that shows a view by id across all registered IViewProviders, regardless of which subsystem owns it (menu, custom view, …). It also knows the application's initial/root view, so the boot path and the return-to-menu-after-gameplay path can show it without assuming it is a menu.
Inherited Members
Namespace: Serenity.Global.Application.Interfaces
Assembly: Serenity.Global.Application.dll
Syntax
public interface IViewRouter : IService, IFoundationSettings
Methods
ClearCurrentView()
Forgets the tracked current view without hiding anything. Used when a subsystem (e.g. the menu
service's DeactivateMenuContext) hides the active view outside the router, so the
router's state does not go stale and cause a spurious hide on the next ShowView(string).
Declaration
void ClearCurrentView()
HideView(string)
Hides the view with the given id via whichever provider owns it.
Declaration
void HideView(string viewId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | viewId | The id of the view to hide. |
RegisterProvider(IViewProvider)
Registers a provider (a subsystem that owns top-level views) consulted when resolving ids.
Declaration
void RegisterProvider(IViewProvider provider)
Parameters
| Type | Name | Description |
|---|---|---|
| IViewProvider | provider | The provider to add. |
SetInitialViewId(string)
Sets the id of the initial/root view shown by ShowInitialView().
Declaration
void SetInitialViewId(string viewId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | viewId | The initial view id (may be a menu or a custom view). |
ShowInitialView()
Shows the configured initial/root view.
Declaration
void ShowInitialView()
ShowView(string)
Shows the view with the given id via whichever provider owns it, first hiding the currently shown top-level view (if any and different). This is how navigation "deactivates the current view and activates the target" uniformly for menus and composite custom views.
Declaration
void ShowView(string viewId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | viewId | The id of the view to show. |