// 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(); }
private void Item_Delete_Click(object sender, RoutedEventArgs e) { BusTagVM bt = (sender as MenuItem).DataContext as BusTagVM; DataService.DeleteBus(bt); DataContext = new KeyedBusTagVM(); }