示例#1
0
        // private void Refesh_Click(object sender, RoutedEventArgs e)
        // {
        //     loadItems();
        // }

        private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (WebStatusHelper.IsOnline())
            {
                try
                {
                    switch (mainpivot.SelectedIndex)
                    {
                    case 0:
                    {
                        if (!isTopicLoaded)
                        {
                            // string url = "http://api.bilibili.com/x/web-show/res/loc?jsonp=jsonp&pf=0&id=23";
                            // List<Models.Topic> MyList = await ContentServ.GetTopicListAsync(url);
                            // foreach (var item in MyList)
                            // {
                            //     show_1.Source.Add(new Controls.RecommandShow.MySource { bmp = new BitmapImage { UriSource = new Uri(item.Pic) }, url = item.Url });
                            // }
                            // show_1.show();
                            await comment.init();

                            header_Home.init(await ContentServ.GetHomeBanners());
                            header_Home.navi += Header_navi;
                            isTopicLoaded     = true;
                        }
                    }
                    break;

                    case 1:
                    {
                        if (!await addcomment(cursor))
                        {
                            await addcomment(cursor);
                        }
                        header_bangumi.init(await ContentServ.GetBangumiBanners());
                        if (list_lastupdate.Items.Count == 0)
                        {
                            list_lastupdate.ItemsSource = await ContentServ.GetLastUpdateAsync();
                        }
                        header_bangumi.navi += Header_navi;
                    }
                    break;

                    case 2:
                    {
                        if (!isFriendsLoaded)
                        {
                            await loadpulls(1);

                            isFriendsLoaded = true;
                        }
                    }
                    break;

                    case 3:
                    {
                        // 发现
                        if (list_hottags.Items.Count == 0)
                        {
                            list_hottags.ItemsSource = await ContentServ.GetHotSearchAsync();
                        }
                    }
                    break;
                    }
                }
                catch (Exception err)
                {
                    string a = err.Message;
                }
            }
        }
示例#2
0
        //private void Refesh_Click(object sender, RoutedEventArgs e)
        //{
        //    loadItems();
        //}

        private async void mainpivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TextBlock txt = this.FindName(string.Format("h{0}", mainpivot.SelectedIndex)) as TextBlock;

            for (int i = 0; i < mainpivot.Items.Count; i++)
            {
                TextBlock temp = this.FindName(string.Format("h{0}", i)) as TextBlock;
                temp.Foreground = new SolidColorBrush(Colors.LightGray);
            }
            txt.Foreground = new SolidColorBrush(Colors.White);
            if (WebStatusHelper.IsOnline())
            {
                try
                {
                    switch (mainpivot.SelectedIndex)
                    {
                    case 0:
                    {
                        if (!isTopicLoaded)
                        {
                            bar.Visibility = Visibility.Visible;
                            //string url = "http://api.bilibili.com/x/web-show/res/loc?jsonp=jsonp&pf=0&id=23";
                            //List<Models.Topic> MyList = await ContentServ.GetTopicListAsync(url);
                            //foreach (var item in MyList)
                            //{
                            //    show_1.Source.Add(new Controls.RecommandShow.MySource { bmp = new BitmapImage { UriSource = new Uri(item.Pic) }, url = item.Url });
                            //}
                            //show_1.show();
                            await comment.init();

                            bar.Visibility = Visibility.Collapsed;
                            isTopicLoaded  = true;
                        }
                    }
                    break;

                    case 1:
                    {
                        bar.Visibility = Visibility.Visible;

                        if (!await addcomment(cursor))
                        {
                            await addcomment(cursor);
                        }
                        header_bangumi.init(await ContentServ.GetFilpItems(), 3.2);
                        if (list_lastupdate.Items.Count == 0)
                        {
                            list_lastupdate.ItemsSource = await ContentServ.GetLastUpdateAsync();
                        }
                        header_bangumi.navi += Header_bangumi_navi;
                        bar.Visibility       = Visibility.Collapsed;
                    }
                    break;

                    case 2:
                    {
                        if (!isFriendsLoaded)
                        {
                            bar.Visibility = Visibility.Collapsed;
                            await loadfriends();

                            bar.Visibility  = Visibility.Visible;
                            isFriendsLoaded = true;
                        }
                    }
                    break;

                    case 3:
                    {
                        //list_live
                    }
                    break;

                    case 4:
                    {
                        //发现
                        if (list_hottags.Items.Count == 0)
                        {
                            list_hottags.ItemsSource = await ContentServ.GetHotSearchAsync();
                        }
                    }
                    break;
                    }
                }
                catch
                {
                }
            }
        }