private void SetContent(Uri newSource, NavigationType navigationType, object newContent, bool contentIsError) { var oldContent = this.Content as IContent; // assign content this.Content = newContent; // do not raise navigated event when error if (!contentIsError) { var args = new NavigationEventArgs { Frame = this, Source = newSource, Content = newContent, NavigationType = navigationType }; OnNavigated(oldContent, newContent as IContent, args); } // set IsLoadingContent to false SetValue(IsLoadingContentPropertyKey, false); if (!contentIsError) { // and raise optional fragment navigation events string fragment; NavigationHelper.RemoveFragment(newSource, out fragment); if (fragment != null) { // fragment navigation var fragmentArgs = new FragmentNavigationEventArgs { Fragment = fragment }; OnFragmentNavigation(newContent as IContent, fragmentArgs); } } }
private void OnNavigated(IContent oldContent, IContent newContent, NavigationEventArgs e) { // invoke IContent.OnNavigatedFrom and OnNavigatedTo if (oldContent != null) { oldContent.OnNavigatedFrom(e); } if (newContent != null) { newContent.OnNavigatedTo(e); } // raise the Navigated event if (Navigated != null) { Navigated(this, e); } }