protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); NavigationMode = e.NavigationMode; if (e.NavigationMode == NavigationMode.New) { GetType().RemovePageFromBackStack(); try { LVPosts.ItemsSource = null; } catch { } } try { if (e.Parameter != null && e.Parameter is object[] obj && obj?.Length == 3) { if (obj[0] is InstaUserInfo userInfo) { User = userInfo; } if (obj[1] is UserDetailsMediasGenerator generator) { MediaGeneratror = generator; } SelectedIndex = (int)obj[2]; } } catch { } }
public void ResetCache() { try { try { MediaGeneratror = null; } catch { } User = null; } catch { } }
public async void SetInfo(InstaUserShort user, UserDetailsMediasGenerator generator, ScrollViewer scroll) { if (user == null) { return; } if (generator == null) { return; } User = user; MediaGeneratror = generator; await Task.Delay(500); if (scroll != null) { scroll.ViewChanging += MediaGeneratror.Scroll_ViewChanging; } }
public async void SetData(InstaUserShort user, UserDetailsMediasGenerator mediaGeneratror) { try { User = user; MediaGeneratror = mediaGeneratror; if (!CanLoadFirstPopUp) { try { LVPosts.ItemsSource = null; } catch { } if (Scroll == null) { Scroll = LVPosts.FindScrollViewer(); if (Scroll != null) { Scroll.ViewChanging += ScrollViewViewChanging; } } //LVPosts.ItemsSource = null; //ScrollableUserPostVM.ResetCache(); ScrollableUserPostVM.SetInfo(User, MediaGeneratror, Scroll); LVPosts.ItemsSource = ScrollableUserPostVM.MediaGeneratror.Items; ////LVPosts.ItemsSource = ScrollableUserPostVM.MediaGeneratror.ItemsX; await Task.Delay(500); //LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.Items[SelectedIndex]); ////LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.ItemsX[SelectedIndex]); CanLoadFirstPopUp = true; } } catch { } }