Example #1
0
        // First... validates URI
        public override Task <ShellRouteState> ParseAsync(ShellUriParserArgs args)
        {
            ShellRouteState newState = args.Shell.RouteState;

            //var newState = RebuildCurrentState(args.Shell.CurrentState.Location, args.Shell.Items);
            //var currentUri = args.Shell.CurrentState.Location;
            var navigationSegments = UriParsingHelper.GetUriSegments(args.Uri);

            navigationSegments.ToList().ForEach(x =>
            {
                var segmentName = UriParsingHelper.GetSegmentName(x);

                // ../ViewA
                if (segmentName == RemovePageRelativePath && newState.CurrentRoute.PathParts.Count >= 3)
                {
                    var currentRoutes = newState.CurrentRoute.PathParts.ToList();
                    currentRoutes.RemoveAt(newState.CurrentRoute.PathParts.Count - 1);
                    newState.CurrentRoute.PathParts = currentRoutes;
                    //return null;
                }
                else
                {
                    //ViewA?id=5&grapes=purple/ViewB?id=3
                    //ViewA?id=5&id=4&id=2&id=1&grapes=purple

                    var segmentParts         = segmentName.Split('?');
                    var navigationParameters = UriParsingHelper.GetSegmentParameters(x, _currentParameters);
                    var shellItem            = GetShellItem(args.Shell.Items, segmentName);
                    //return new PrismPathPart(shellItem, segmentName, navigationParameters);
                    newState.Add(new PathPart(shellItem, new Dictionary <string, string> {
                        { "foo", x }
                    }));
                }
            });

            // newState.Add(newPathParts.Where(x => x != null && x.ShellPart != null).ToList());

            // var routePath = new RoutePath(newState, null);
            // var routeState = new ShellRouteState(routePath);
            // Home/Demo

            // Routing.ImplicitPrefix = "IMPL_";
            //var item = args.Shell.Items.First(x => x.Route.StartsWith("IMPL_"));

            return(Task.FromResult(newState));
        }
Example #2
0
        public override async Task <ShellRouteState> ParseAsync(ShellUriParserArgs args)
        {
            #region back button ..
            //if (args.Uri.ToString() == "..")
            //{
            //    var lastPlace = navigationStack.Last();
            //    navigationStack.Remove(lastPlace);

            //    var parsePrevious = await base.ParseAsync(new ShellUriParserArgs(args.Shell, navigationStack.LastOrDefault()));
            //    return parsePrevious;
            //}
            #endregion


            var parseArgs = await base.ParseAsync(args);

            return(parseArgs);
        }