private void boardLst_SelectionChanged(object sender, SelectionChangedEventArgs e) { ChanBoard chanBoard = boardLst.SelectedValue as ChanBoard; if (chanBoard == null) { return; } Frame.Navigate(typeof(threadPage), new Tuple <BaseChan, ChanBoard>(chanSite, chanBoard)); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var navData = e.Parameter as Tuple <BaseChan, ChanBoard>; chanSite = navData.Item1; chanBoard = navData.Item2; if (chanSite != null) { var src = await chanSite.GetCatalogForBoardAsync(chanBoard.UrlSlug); threadLst.ItemsSource = src; } }
private void threadLst_SelectionChanged(object sender, SelectionChangedEventArgs e) { BaseChan bc = siteLst.SelectedValue as BaseChan; ChanBoard cb = boardLst.SelectedValue as ChanBoard; ChanCatalogThread cct = threadLst.SelectedValue as ChanCatalogThread; if (bc == null || cb == null || cct == null) { return; } imageLst.ItemsSource = null; LoadingBlock.Visibility = Visibility.Visible; Task t = new Task(async() => { var posts = await bc.GetPostsForTheadAsync(cct.BoardSlug, (int)cct.ThreadId); if (posts == null || posts.Count() == 0) { return; } await Dispatcher.InvokeAsync(() => { imageLst.ItemsSource = posts.Where(m => m.Files != null).SelectMany(m => m.Files); if (imageLst.Items.Count > 0) { imageLst.ScrollIntoView(imageLst.Items[0]); } (controlTabs.Items[3] as TabItem).Visibility = Visibility.Visible; controlTabs.SelectedIndex = 3; LoadingBlock.Visibility = Visibility.Hidden; updateBreadCrumbs(bc.DisplayName, cb.Title, string.Format("{0} - {1}", cct.ThreadId, cct.SubjectSafe)); }); }); t.Start(); }
private void boardLst_SelectionChanged(object sender, SelectionChangedEventArgs e) { BaseChan bc = siteLst.SelectedValue as BaseChan; ChanBoard cb = boardLst.SelectedValue as ChanBoard; if (bc == null || cb == null) { return; } threadLst.ItemsSource = null; LoadingBlock.Visibility = Visibility.Visible; Task t = new Task(async() => { var threads = await bc.GetCatalogForBoardAsync(cb.UrlSlug); if (threads == null || threads.Count() == 0) { return; } await Dispatcher.InvokeAsync(() => { threadLst.ItemsSource = threads.OrderByDescending(th => th.Posts); threadLst.ScrollIntoView(threadLst.Items[0]); (controlTabs.Items[2] as TabItem).Visibility = Visibility.Visible; controlTabs.SelectedIndex = 2; LoadingBlock.Visibility = Visibility.Hidden; updateBreadCrumbs(bc.DisplayName, cb.Title); }); }); t.Start(); }