Method HookWindowActivatedEvent
HookWindowActivatedEvent(Window, Func<Navigator, Task>, Func<Navigator, NavigationRouteException, Task>?)
Configures the navigator to handle the first window activation by triggering an initial navigation action. Must be called before the window is activated for the initial navigation to work.
Declaration
public void HookWindowActivatedEvent(Window window, Func<Navigator, Task> navigationAction, Func<Navigator, NavigationRouteException, Task>? fallbackAction = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Window | window | The window to configure initial navigation for. |
| Func<Navigator, Task> | navigationAction | The action to perform for initial navigation. |
| Func<Navigator, NavigationRouteException, Task> | fallbackAction | The action to perform if resolving the initial navigation fails. Can be used to show an error and/or navigate to a known good fallback route. If not provided, no fallback action will be performed and exceptions will be propagated to the UI thread. |
Remarks
This method simplifies the common scenario of triggering initial navigation when the window is first activated, while ensuring that initial navigation is only triggered once and errors while attempting initial navigation can be handled gracefully.