コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }