// Load data for the ViewModel Items protected override void OnNavigatedTo(NavigationEventArgs e) { Log.Debug("e=" + e.DumpStr()); Log.Debug("NavigationContext.QueryString=" + NavigationContext.QueryString.DumpStr()); //Log.Debug("App.RecusiveBack=" + App.RecusiveBack); if (NavigationContext.QueryString.GetValue("Op", "") == "Add" //&& App.RecusiveBack==true && e.NavigationMode == NavigationMode.New) { while (NavigationService.CanGoBack) { JournalEntry jo = NavigationService.RemoveBackEntry(); Log.Debug("jo.Source=" + jo.Source); } DataService.AddBus(new BusTag { busName = NavigationContext.QueryString["busName"], station = NavigationContext.QueryString["station"], dir = (BusDir)Enum.Parse(typeof(BusDir), NavigationContext.QueryString["dir"]), tag = NavigationContext.QueryString["tag"] }); //App.RecusiveBack = false; //DataService.SaveData(); } DataContext = new KeyedBusTagVM(); Log.Debug("exit"); //NavigationContext.QueryString.Clear(); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { Log.Debug("e=" + e.DumpStr()); Log.Debug("NavigationContext.QueryString=" + NavigationContext.QueryString.DumpStr()); Log.Debug("exit"); //NavigationContext.QueryString.Clear(); }
private void CheckForResetNavigation(object sender, NavigationEventArgs e) { Log.Debug("e=" + e.DumpStr()); // 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; } }
// Do not add any additional code to this method private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { Log.Debug("e=" + e.DumpStr()); // 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) { Log.Debug("e=" + e.DumpStr()); // 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 } }