Example #1
0
        async Task <bool> PopNavigationState()
        {
            NavigationState navigationState = navigationStateStack [navigationStateStack.Count - 1];
            IScreenState    screenToPop     = navigationState.ScreenState;

            navigationStateStack.RemoveAt(navigationStateStack.Count - 1);

            NavigationState lastState = LastNavigationState();

            if (!await screenToPop.HideState())
            {
                return(false);
            }
            if (!await App.Current.Navigation.Pop(lastState?.ScreenState.Panel))
            {
                return(false);
            }
            await App.Current.EventsBroker.Publish(new NavigationEvent { Name = Current.Name });

            if (!await navigationState.Unload())
            {
                return(false);
            }
            screenToPop.Dispose();
            return(true);
        }
Example #2
0
        async Task <bool> PopModalState(NavigationState current)
        {
            NavigationState navigationState = modalStateStack [modalStateStack.Count - 1];
            IScreenState    screenToPop     = navigationState.ScreenState;

            if (!await screenToPop.HideState())
            {
                return(false);
            }
            if (!await navigationState.Unload())
            {
                return(false);
            }
            modalStateStack.RemoveAt(modalStateStack.Count - 1);
            await App.Current.EventsBroker.Publish(new NavigationEvent { Name = Current.Name, IsModal = modalStateStack.Any() });

            await App.Current.Navigation.PopModal(screenToPop.Panel);

            screenToPop.Dispose();
            return(true);
        }