private async Task <INavigationResult> NavigateAsync( NavigationQueue queue, NavigationTransitionInfo infoOverride) { _logger.Log($"{nameof(FrameFacade)}.{nameof(NavigateAsync)}({queue})", Category.Info, Priority.None); // clear stack, if requested if (queue.ClearBackStack) { _frame.SetNavigationState(new Frame().GetNavigationState()); } // iterate through queue while (queue.Count > 0) { var pageNavinfo = queue.Dequeue(); var result = await NavigateAsync( pageNavInfo : pageNavinfo, infoOverride : infoOverride); // do not continue on failure if (!result.Success) { return(result); } } // finally return(this.NavigationSuccess()); }
public async Task <INavigationResult> NavigateAsync( Uri path, INavigationParameters parameter, NavigationTransitionInfo infoOverride) { return(await NavigateAsync( queue : NavigationQueue.Parse(path, parameter), infoOverride : infoOverride)); }
public static bool TryParse(string path, INavigationParameters parameters, out NavigationQueue queue) { if (string.IsNullOrEmpty(path)) { queue = null; return(false); } if (Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out var uri)) { return(TryParse(new Uri(path, UriKind.Relative), parameters, out queue)); } else { queue = null; return(false); } }
public static bool TryParse(Uri uri, INavigationParameters parameters, out NavigationQueue queue) { if (uri == null) { queue = null; return(false); } if (uri.IsAbsoluteUri) { throw new Exception("Navigation path must not be absolute Uri."); } var groups = uri.OriginalString.Split('/') .Where(x => !string.IsNullOrEmpty(x)) .Select((path, index) => new NavigationPath(index, path, parameters)); queue = new NavigationQueue(groups) { ClearBackStack = uri.OriginalString.StartsWith("/"), }; return(queue.Any()); }