/// <summary> /// Called when the <see cref="LogicBase.TargetView"/> has just been unloaded. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void OnTargetViewUnloaded(object sender, EventArgs e) { if (!_hasHandledNavigatingAway) { OnNavigatingAway(this, new NavigatingEventArgs(_navigationAdapter.GetNavigationUriForTargetPage(), NavigationMode.New)); _hasHandledNavigatingAway = true; } base.OnTargetViewUnloaded(sender, e); DestroyNavigationAdapter(); }
private void CreateNavigationAdapter(bool comingFromLoadedEvent) { if (_navigationAdapter == null) { _navigationAdapter = new NavigationAdapter(TargetPage); _navigationAdapter.NavigatedTo += OnNavigatedTo; _navigationAdapter.NavigatingAway += OnNavigatingAway; _navigationAdapter.NavigatedAway += OnNavigatedAway; if (comingFromLoadedEvent) { OnNavigatedTo(this, new NavigatedEventArgs(_navigationAdapter.GetNavigationUriForTargetPage(), NavigationMode.New)); } } }
private void CreateNavigationAdapter(bool comingFromLoadedEvent) { if (_navigationAdapter == null) { var serviceLocator = this.GetServiceLocator(); var navigationService = serviceLocator.ResolveType <INavigationRootService>(); var navigationRoot = navigationService.GetNavigationRoot(); _navigationAdapter = new NavigationAdapter(TargetPage, navigationRoot); _navigationAdapter.NavigatedTo += OnNavigatedTo; _navigationAdapter.NavigatingAway += OnNavigatingAway; _navigationAdapter.NavigatedAway += OnNavigatedAway; if (comingFromLoadedEvent) { OnNavigatedTo(this, new NavigatedEventArgs(_navigationAdapter.GetNavigationUriForTargetPage(), NavigationMode.New)); } } }