public override void OnNavigatedTo(NavigationEventArgs e, bool setStatusBar = true) { #if WINDOWS_PHONE_APP if (setStatusBar) { SetStatusBarColor((FrameworkElement)e.Content); } #endif if (e.NavigationMode == NavigationMode.New) { PageStateStack.Push(this.State); if (InitializeState != null) { InitializeState(e.Parameter); } } else if (e.NavigationMode == NavigationMode.Back) { var currentState = PageStateStack.Top(); if (State.PageType != currentState.PageType) { throw new InvalidOperationException(); } if (currentState != this.State) { this.state = currentState; State.UpdateTasks(this.Page); PageStateStack.Pop(); PageStateStack.Push(State); if (RestoreState != null) { RestoreState(State.StateObject); } } State.ResumeTasks(); } else { throw new NotImplementedException("Not allowed navigation mode:" + e.NavigationMode); } }
public static void Push(PageState state) { BackStack.Add(state); }