// Load data for the ViewModel Items protected override void OnNavigatedTo(NavigationEventArgs e) { if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } }
public NavigatedEventArgs(NavigationEventArgs e, Page page) { Page = page; PageType = e.SourcePageType; Parameter = e.Parameter; NavigationMode = e.NavigationMode; }
internal NavigationEventArgsAdapter( NavigationEventArgs source ) { Contract.Requires( source != null ); this.source = source; Uri = source.Uri; IsSuccess = true; }
async private void DialogWebBrowserOnLoadCompleted(object sender, NavigationEventArgs args) #endif { if (args.Uri.ToString().StartsWith("https://www.facebook.com/connect/login_success.html")) { if (ParentControlPopup != null) { ParentControlPopup.IsOpen = false; } if (!args.Uri.Fragment.Contains("access_token")) { // this callback is in return for the dialog, so just cancel it. if (OnDialogFinished != null) { OnDialogFinished(WebDialogResult.WebDialogResultDialogCompleted); } return; } try { var client = new FacebookClient(); var authResult = client.ParseOAuthCallbackUrl(args.Uri); client = new FacebookClient(authResult.AccessToken); var parameters = new Dictionary<string, object>(); parameters["fields"] = "id"; var result = await client.GetTaskAsync("me", parameters); var dict = (IDictionary<string, object>)result; Session.ActiveSession.CurrentAccessTokenData = new AccessTokenData { AccessToken = authResult.AccessToken, Expires = authResult.Expires, FacebookId = (string)dict["id"], AppId = Session.AppId }; if (Session.OnFacebookAuthenticationFinished != null) { Session.OnFacebookAuthenticationFinished(Session.ActiveSession.CurrentAccessTokenData); } if (Session.OnSessionStateChanged != null) { Session.OnSessionStateChanged(LoginStatus.LoggedIn); } } catch (Facebook.FacebookOAuthException exc) { // TODO: (sanjeevd) catch appropriately } } }
void FrameNavigated(object sender, NavigationEventArgs e) { #if WINDOWS_PHONE if (e.IsNavigationInitiator) #endif { Dispose(); } }
protected virtual void DumpExistingViewModel(NavigationEventArgs e) { // Make sure we get a new VM each time we arrive at the page if (e.NavigationMode != NavigationMode.Back) { DataContext = null; ViewModel = null; } }
protected internal override void InternalOnNavigatedFrom(NavigationEventArgs e) { base.InternalOnNavigatedFrom(e); var frameState = SuspensionManager.SessionStateForFrame(Frame); var pageState = new Dictionary<String, Object>(); SaveState(pageState); frameState[pageKey] = pageState; }
/// <summary> /// Invoked immediately after the Page is unloaded and is no longer the current source of a parent Frame. /// </summary> /// <param name="e">Event data that can be examined by overriding code. The event data is representative of the navigation that has unloaded the current Page.</param> protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); var vm = this.DataContext as BaseViewModel; if (vm != null) { vm.OnLeft(); } }
/// <summary> /// Invoked immediately after the page is unloaded and is no longer the current source of a parent frame. /// </summary> /// <param name="e">An object that contains the event data.</param> protected override async void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); var handler = DataContext as IHandleNavigatedFrom; if (handler != null) { await InvokeHandlerOnNavigatedFromAsync(handler, e.ToNavigationServiceNavigationEventArgs()); } }
// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.ExtraData == null) { // user inadvertently landed to the error page, redirect to the home page this.GetNavigator().Navigate(new Uri("/Home", UriKind.Relative)); return; } ApplicationUnhandledExceptionEventArgs errorArgs = e.ExtraData as ApplicationUnhandledExceptionEventArgs; errorDetails.Text = errorArgs.ExceptionObject.Message + "\n" + errorArgs.ExceptionObject.StackTrace; }
private void OnFirstNavigation( object sender, NavigationEventArgs e ) { Contract.Requires( sender != null ); Contract.Requires( e != null ); var frame = (Frame) sender; frame.Navigated -= OnFirstNavigation; frame.ContentTransitions = transitions ?? new TransitionCollection() { new NavigationThemeTransition() }; transitions = null; }
void FacadeNavigatedEventHandler(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e) { foreach (var handler in _navigatedEventHandlers) { var args = new NavigationEventArgs() { NavigationMode = e.NavigationMode, Parameter = (e.Parameter == null) ? string.Empty : e.Parameter.ToString() }; handler(this, args); } }
/// <summary> /// When navigating to this page, DataContext.ImageStream will be set as the source /// for the Image control in XAML. If ImageStream is null, application will navigate /// directly back to the main page. /// </summary> protected override void OnNavigatedTo(NavigationEventArgs e) { if (_dataContext.ImageStream != null) { _bitmap.SetSource(_dataContext.ImageStream); image.Source = _bitmap; } else { NavigationService.GoBack(); } base.OnNavigatedTo(e); }
// set the browser's page title using branded format string private void ContentFrame_Navigated(object sender, NavigationEventArgs e) { string title = string.Empty; object content = e.Content; if (content == null) content = ContentFrame.Content; if (content is Page) title = ((Page)content).Title; if (CrossPlatform.IsHtmlPageEnabled()) CrossPlatform.SetDocumentTitle("Intersoft ClientUI Application | " + title); }
protected override void OnNavigatedTo(NavigationEventArgs args) { if (Manager.CanGoBack) { BackButton = Button.TextButton(Manager, Languages.OctoClient.Back); BackButton.VerticalAlignment = VerticalAlignment.Top; BackButton.HorizontalAlignment = HorizontalAlignment.Left; BackButton.LeftMouseClick += (s, e) => { Manager.NavigateBack(); }; BackButton.Margin = new Border(10, 10, 10, 10); Controls.Add(BackButton); } }
protected internal override void InternalOnNavigatedTo(NavigationEventArgs e) { base.InternalOnNavigatedTo(e); if (pageKey != null) // new instance return; var frameState = SuspensionManager.SessionStateForFrame(Frame); pageKey = "Page" + Frame.BackStackDepth; if (e.NavigationMode == NavigationMode.New) { var nextPageKey = pageKey; var nextPageIndex = Frame.BackStackDepth; while (frameState.Remove(nextPageKey)) { nextPageIndex++; nextPageKey = "Page" + nextPageIndex; } LoadState(e.Parameter, null); } else LoadState(e.Parameter, (Dictionary<String, Object>)frameState[pageKey]); }
// Do not add any additional code to this method private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { // Set the root visual to allow the application to render if (RootVisual != RootFrame) RootVisual = RootFrame; // Remove this handler since it is no longer needed RootFrame.Navigated -= CompleteInitializePhoneApplication; }
private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) { // Unregister the event so it doesn't get called again RootFrame.Navigated -= ClearBackStackAfterReset; // Only clear the stack for 'new' (forward) and 'refresh' navigations if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) return; // For UI consistency, clear the entire page stack while (RootFrame.RemoveBackEntry() != null) { ; // do nothing } }
private void CheckForResetNavigation(object sender, NavigationEventArgs e) { // If the app has received a 'reset' navigation, then we need to check // on the next navigation to see if the page stack should be reset if (e.NavigationMode == NavigationMode.Reset) RootFrame.Navigated += ClearBackStackAfterReset; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { try { DumpExistingViewModel(e); base.OnNavigatedTo(e); #if WINDOWS_PHONE_APP HardwareButtons.BackPressed += HardwareButtons_BackPressed; #elif WINDOWS_UWP if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; } if (CanSubscribeToBackRequest) { SubscribeToBackRequestedEvent(); } if (AutomaticallyShowAppViewBackButton) { if (DisplayAppViewBackButton) { var rootFrame = Window.Current.Content as Frame; if (rootFrame != null) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = rootFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; } } } #endif if (GoBackViewModel != null) { GoBackViewModel.ClearPreviousViews += ClearViews; } var satvm = StatesAndTransitionsViewModel; if (satvm != null) { satvm.StateChanged += ViewModelStateChanged; satvm.RunStoryboard += RunStoryboard; satvm.StopStoryboard += StopStoryboard; // Force a refresh of all current states satvm.RefreshStates(); } var bvm = ViewModel as BaseViewModel; if (bvm != null) { await bvm.WaitForStartCompleted(); } await OnNavigatedToCompleted(); } catch (Exception exception) { Debug.WriteLine(exception.Message); } }
protected override IMvxBundle LoadStateBundle(NavigationEventArgs navigationEventArgs) { try { var bundle = base.LoadStateBundle(navigationEventArgs); if (bundle == null) { bundle = new MvxBundle(); } foreach (var data in State) { bundle.Data[data.Key] = data.Value.ToString(); } return bundle; } catch (Exception exception) { Debug.WriteLine(exception.Message); return null; } }
protected override void SaveStateBundle(NavigationEventArgs navigationEventArgs, IMvxBundle bundle) { try { base.SaveStateBundle(navigationEventArgs, bundle); foreach (var data in bundle.Data) { State[data.Key] = data.Value; } } catch (Exception exception) { Debug.WriteLine(exception.Message); } }
protected override void OnNavigatedFrom(NavigationEventArgs e) { try { #if WINDOWS_PHONE_APP HardwareButtons.BackPressed -= HardwareButtons_BackPressed; #elif WINDOWS_UWP if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed; } if (CanSubscribeToBackRequest) { UnsubscribeFromBackRequestedEvent(); } #endif if (GoBackViewModel != null) { GoBackViewModel.ClearPreviousViews -= ClearViews; } var satvm = StatesAndTransitionsViewModel; if (satvm != null) { satvm.StateChanged -= ViewModelStateChanged; satvm.RunStoryboard -= RunStoryboard; satvm.StopStoryboard -= StopStoryboard; //EventsWired = false; } base.OnNavigatedFrom(e); #if WINDOWS_UWP if (EnablePageCaching) { if (e.NavigationMode == NavigationMode.Back) { NavigationCacheMode = NavigationCacheMode.Disabled; } } #endif } catch (Exception exception) { Debug.WriteLine(exception.Message); } }
void SlideApplicationFrame_Navigated(object sender, NavigationEventArgs e) { _appBarVisibility = null; if (_header != null) { var content = e.Content as DependencyObject; if (content != null) { var hide = GetHideHeader(content); ToggleHeaderVisibility(hide); } } }
/// <summary> /// The navigation list navigation. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void NavigationListNavigation(object sender, NavigationEventArgs e) { var trip = e.Item as Trip; Debug.Assert(trip != null); Debug.Assert(trip.Key != 0); // navigate to the feed items page this.NavigationService.Navigate(new Uri(string.Format("/Views/TripView.xaml?id={0}", trip.Key), UriKind.Relative)); }
protected override async void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); if (e.NavigationMode == NavigationMode.New || e.NavigationMode == NavigationMode.Back) { var element = MainList.GetTopViewIndex(); if (element?.Link != null) { await SetStoredCurrentPost(navigatedLink, element.Link); } } NavigatedFrom?.Invoke(this, e); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { landingPageController.OnResponseReceived -= LandingPageController_OnResponseReceived; base.OnNavigatedFrom(e); }
// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { }
public NavigatedEventArgs(NavigationEventArgs e) { this.PageType = e.SourcePageType; this.Parameter = e.Parameter?.ToString(); this.NavigationMode = e.NavigationMode; }
protected virtual void RaiseNavigated(NavigationEventArgs args) { Navigated?.Invoke(this, args); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var linkTransform = ServiceLocator.Current.GetServiceOrThrow<ILinkTransformService>(); var link = NavigationHelper.GetLinkFromParameter(e.Parameter); navigatedLink = linkTransform.GetThreadLinkFromAnyLink(link); navigatePostLink = null; if (link != null) { if ((link.LinkKind & BoardLinkKind.Post) != 0 && e.NavigationMode != NavigationMode.Back) { navigatePostLink = link; } } if (navigatedLink == null) { await AppHelpers.ShowError(new InvalidOperationException("Неправильный тип параметра навигации")); BootStrapper.Current.NavigationService.GoBack(); return; } savedTopPostHash = await GetStoredCurrentPostHash(navigatedLink); isTopPostSet = true; var vm = new ThreadViewModel(navigatedLink); ViewModel = vm; vm.PostsUpdated += LiteWeakEventHelper.CreateHandler(new WeakReference<ThreadPage>(this), (root, esender, ee) => root.OnPostsUpdated(esender, ee)); isBackNavigated = e.NavigationMode == NavigationMode.Back; vm.IsBackNavigatedToViewModel = isBackNavigated; vm.PropertyChanged += ViewModelOnPropertyChanged; ViewModelOnPropertyChanged(vm, new PropertyChangedEventArgs(null)); NavigatedTo?.Invoke(this, e); }
void OnNavigated(object sender, NavigationEventArgs e) { UpdateBackButtonVisibility(); }