logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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
    IService.LogService
    Namespace: Serenity.Global.Application.Interfaces
    Assembly: Serenity.Global.Application.dll
    Syntax
    public interface IViewRouter : IService, IFoundationSettings

    Methods

    CanShowView(string)

    True when some registered provider owns a view with the given id — i.e. ShowView(string) would actually show it rather than warn and no-op. Lets a caller with side effects of its own (e.g. popping navigation history before returning) verify the navigation will happen first.

    Declaration
    bool CanShowView(string viewId)
    Parameters
    Type Name Description
    string viewId

    The view id to test.

    Returns
    Type Description
    bool

    True when the id resolves to a registered view.

    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.

    See Also

    IService
    In this article
    © 2026 Serenity. All Rights Reserved