// GC handling! protected override void OnRemovedFromJournal(System.Windows.Navigation.JournalEntryRemovedEventArgs e) { model.Pages.Clear(); model.SelectedPageItem = null; model = null; catalogSlideView.ManipulationCompleted -= catalogSlideView_ManipulationCompleted; catalogSlideView.ItemTemplate = null; catalogSlideView = null; GC.Collect(); GC.WaitForPendingFinalizers(); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); string id = "3c41wO"; // føtex if (NavigationContext.QueryString.ContainsKey("catalogId")) { id = NavigationContext.QueryString["catalogId"]; } model = new CatalogBrowsingViewModel(id); this.DataContext = model; model.LoadData(); if (!string.IsNullOrWhiteSpace(model.Catalog.Branding.Color)) { //model.Catalog.Week.From //this.ContentPanel.Background = new SolidColorBrush(Colors.Red); this.ContentPanel.Background = GetColorFromHexa(model.Catalog.Branding.Color); } int startPage = 0; if (NavigationContext.QueryString.ContainsKey("GoToPage")) { if (int.TryParse(NavigationContext.QueryString["GoToPage"], out startPage)) { int catalogPages = 0; if (int.TryParse(model.Catalog.PageCount, out catalogPages)) { if (startPage > catalogPages) { startPage = 0; } } } } base.OnNavigatedTo(e); catalogSlideView.SelectedIndex = -1; ScrollToPage(startPage); }