Example #1
0
        public void DidDismiss(UIPresentationController _)
        {
            var window = (_modal.VirtualView as Page)?.Window;

            if (window?.Page is Shell shell)
            {
                // The modal page might have a NavigationPage so it's not enough to just send
                // GotoAsync(..) we need build up what the uri will be once the last modal page is removed
                // and then submit that to shell
                var modalStack = new List <Page>(shell.CurrentItem.CurrentItem.Navigation.ModalStack);
                if (modalStack.Count > 0)
                {
                    modalStack.RemoveAt(modalStack.Count - 1);
                }

                var result = ShellNavigationManager.GetNavigationParameters(
                    shell.CurrentItem,
                    shell.CurrentItem.CurrentItem,
                    shell.CurrentItem.CurrentItem.CurrentItem,
                    shell.CurrentItem.CurrentItem.Stack, modalStack);

                shell.NavigationManager.GoToAsync(result).FireAndForget();
            }
            else
            {
                ((Page)_modal.VirtualView).Navigation.PopModalAsync(false).FireAndForget();
            }
        }
Example #2
0
        public void TryParseTest(string s, Type type, object expectedResult, bool expectedSuccess)
        {
            var success = ShellNavigationManager.TryParse(type, s, out var result);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(expectedResult, result);
                Assert.AreEqual(expectedSuccess, success);
            });
        }
 public MBBRouteFactory(Type componentType, ShellNavigationManager navigationManager)
 {
     _componentType     = componentType ?? throw new ArgumentNullException(nameof(componentType));
     _navigationManager = navigationManager ?? throw new ArgumentNullException(nameof(navigationManager));
 }
 public MBBRouteFactory(Type type, ShellNavigationManager navigationManager)
 {
     _type = type;
     _navigationManager = navigationManager;
 }