private void OnViewModelReadyToBind(object sender, Common.ThreadReadyToBindEventArgs args) { this.state = args.State; this._threadStack.Push(viewmodel); this.DataContext = viewmodel; this.ThreadInitializationPane.Visibility = System.Windows.Visibility.Collapsed; this.GoToIndex(args.State.PageNumber - 1); VisualStateManager.GoToState(this, "Reading", true); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); if (!e.IsNavigationInitiator) { this.state.Save(this); } else { this.state = null; this._threadStack.Clear(); } }
private void BuildStateFromIsoStore() { state = ThreadViewPageState.Load(); if (state == null) { BuildStateFromNavigationQuery(); } else { bool refresh = viewmodel.Thread == null || viewmodel.Thread.ThreadID != state.ThreadID; refresh = refresh && (viewmodel.SelectedItem == null || viewmodel.SelectedItem.PageNumber != state.PageNumber); if (refresh) { this.viewmodel.UpdateModel(state); this.DataContext = viewmodel; this.GoToIndex(state.PageNumber); } } }
public static void Save(ThreadViewPageState state) { state.SaveToFile(SAVE_FILE); }