private BeforeRouterResult Navigate(RouteContext to) { var routingEventArgs = new RoutingEventArgs(to, Route, _ViewModel); OnNavigating?.Invoke(this, routingEventArgs); if (routingEventArgs.Cancel) { _CurrentNavigations.Dequeue(); to.Complete(); return(BeforeRouterResult.Cancel()); } var redirect = routingEventArgs.RedirectedTo; if (string.IsNullOrEmpty(redirect)) { _ViewModel = to.ViewModel; return(BeforeRouterResult.Ok()); } to.Redirect(redirect, GetViewModelFromRoute(redirect)); return(BeforeRouterResult.CreateRedirect(redirect)); }
private BeforeRouterResult BeforeResolve(string routeName) { var context = GetRouteContext(routeName); return((context == null) ? BeforeRouterResult.Cancel() : Navigate(context)); }