protected override async Task <INavigationResult> GoBackInternal(INavigationParameters parameters, bool?useModalNavigation, bool animated) { INavigationResult result = null; try { NavigationSource = PageNavigationSource.NavigationService; switch (PopupUtilities.TopPage(_popupNavigation, _applicationProvider)) { case PopupPage popupPage: var segmentParameters = UriParsingHelper.GetSegmentParameters(null, parameters); ((INavigationParametersInternal)segmentParameters).Add("__NavigationMode", NavigationMode.Back); var previousPage = PopupUtilities.GetOnNavigatedToTarget(_popupNavigation, _applicationProvider); await DoPop(popupPage.Navigation, false, animated); if (popupPage != null) { PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(popupPage, a => a.IsActive = false); PageUtilities.OnNavigatedFrom(popupPage, segmentParameters); PageUtilities.OnNavigatedTo(previousPage, segmentParameters); PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(previousPage, a => a.IsActive = true); PageUtilities.DestroyPage(popupPage); result = new NavigationResult { Success = true }; break; } throw new NullReferenceException("The PopupPage was null following the Pop"); default: result = await base.GoBackInternal(parameters, useModalNavigation, animated); break; } } catch (Exception e) { #if DEBUG System.Diagnostics.Debugger.Break(); #endif _logger.Log(e.ToString(), Category.Exception, Priority.High); result = new NavigationResult { Success = false, Exception = e };; } finally { NavigationSource = PageNavigationSource.Device; } return(result); }
public override async Task <INavigationResult> GoBackAsync(INavigationParameters parameters) { try { NavigationSource = PageNavigationSource.NavigationService; switch (PopupUtilities.TopPage(_popupNavigation, _applicationProvider)) { case PopupPage popupPage: var segmentParameters = UriParsingHelper.GetSegmentParameters(null, parameters); ((INavigationParametersInternal)segmentParameters).Add("__NavigationMode", NavigationMode.Back); var previousPage = PopupUtilities.GetOnNavigatedToTarget(_popupNavigation, _applicationProvider); PageUtilities.OnNavigatingTo(previousPage, segmentParameters); await DoPop(popupPage.Navigation, false, true); if (popupPage != null) { PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(popupPage, a => a.IsActive = false); PageUtilities.OnNavigatedFrom(popupPage, segmentParameters); PageUtilities.OnNavigatedTo(previousPage, segmentParameters); PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(previousPage, a => a.IsActive = true); PageUtilities.DestroyPage(popupPage); return(new NavigationResult { Success = true }); } throw new NullReferenceException("The PopupPage was null following the Pop"); default: return(await base.GoBackAsync(parameters)); } } catch (Exception e) { _logger.Log(e.ToString(), Category.Exception, Priority.High); return(new NavigationResult { Success = false, Exception = e });; } finally { NavigationSource = PageNavigationSource.Device; } }
public override async Task <bool> GoBackAsync(INavigationParameters parameters = null, bool?useModalNavigation = default(bool?), bool animated = true) { try { NavigationSource = PageNavigationSource.NavigationService; switch (PopupUtilities.TopPage(_popupNavigation, _applicationProvider)) { case PopupPage popupPage: var segmentParameters = UriParsingHelper.GetSegmentParameters(null, parameters); segmentParameters.Add(KnownNavigationParameters.NavigationMode, NavigationMode.Back); var previousPage = PopupUtilities.GetOnNavigatedToTarget(_popupNavigation, _applicationProvider); PageUtilities.OnNavigatingTo(previousPage, segmentParameters); await DoPop(popupPage.Navigation, false, animated); if (popupPage != null) { PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(popupPage, a => a.IsActive = false); PageUtilities.OnNavigatedFrom(popupPage, segmentParameters); PageUtilities.OnNavigatedTo(previousPage, segmentParameters); PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(previousPage, a => a.IsActive = true); PageUtilities.DestroyPage(popupPage); return(true); } break; default: return(await base.GoBackAsync(parameters, useModalNavigation, animated)); } } catch (Exception e) { _logger.Log(e.ToString(), Category.Exception, Priority.High); return(false); } finally { NavigationSource = PageNavigationSource.Device; } return(false); }