Interface IMenuService
Interface for a menu service that manages menu views and interactions.
Namespace: Serenity.Menu.Application.Interfaces.Services
Assembly: Serenity.Menu.Application.dll
Syntax
public interface IMenuService : IService, IFoundationSettings, IViewProvider
Remarks
As an IViewProvider, the menu service can also be driven by the top-level view router to show menus by id alongside other view subsystems.
Methods
DeactivateMenuContext()
Deactivates the current menu context, hiding the active menu view and cleaning up any resources.
Declaration
void DeactivateMenuContext()
GetCurrentView()
Gets the current active view in the menu service.
Declaration
IViewBase GetCurrentView()
Returns
| Type | Description |
|---|---|
| IViewBase | The current active view. |
GetView(string)
Resolves a menu view by id, ensuring it is built (including lazy menus), or returns null when no menu with that id exists. Used to host menus inside composite views.
Declaration
IViewBase GetView(string menuId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | The menu id to resolve. |
Returns
| Type | Description |
|---|---|
| IViewBase | The built menu view, or null when unknown. |
InitializeService(Dictionary<string, IViewBase>, IViewBrowserService, string)
Initializes the menu service with the provided menu views.
Declaration
void InitializeService(Dictionary<string, IViewBase> menuViews, IViewBrowserService viewBrowserService, string initMenuId)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<string, IViewBase> | menuViews | A dictionary of menu views to initialize the service with. |
| IViewBrowserService | viewBrowserService | The view browser service for navigation. |
| string | initMenuId | The ID of the initial menu to show when ShowInitialMenu is called. |
SetGameModeService(IGameModeService)
Sets the GameMode service used to coordinate the application mode when the initial menu is shown.
Intended to be invoked by the composition root once the GameMode service has been constructed.
Declaration
void SetGameModeService(IGameModeService gameModeService)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameModeService | gameModeService | The GameMode service implementation to coordinate with. |
ShowInitialMenu()
Shows the initial menu configured during initialization. This is the menu that should be displayed at startup or when returning from gameplay.
Declaration
void ShowInitialMenu()
ShowMenu(string)
Shows the menu with the specified ID.
Declaration
void ShowMenu(string menuId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | The ID of the menu to show. |