Esempio n. 1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string para = sid = e.Parameter.ToString();
            string url  = "http://bangumi.bilibili.com/api/season_v2?_device=wp&build=424000&platform=android&access_key=" + ApiHelper.accesskey + "&appkey=422fd9d7289a1dd9&ts=" + ApiHelper.GetLinuxTS().ToString() + "&type=bangumi&season_id=" + para;

            url += ApiHelper.GetSign(url);
            aa   = await ContentServ.GetSeasonResultAsync(url, 1) as Season_Total;

            BitmapImage bmp = new BitmapImage();

            bmp.UriSource = new Uri(aa.Cover);
            pic.Source    = bmp;
            title.Text    = aa.Title;
            up.Text       = aa.Copyright;
            desc.Text     = aa.Brief;
            count.Text    = "播放:" + aa.View + "\n" + "收藏:" + aa.Fav + "\n" + "弹幕:" + aa.Danmaku + "\n" + "硬币:" + aa.Coins;
            time.Text     = aa.Time;
            staff.Text    = aa.Staff ?? string.Empty;
            if (aa.IsConcerned == "1")
            {
                addfav.Icon  = new SymbolIcon(Symbol.UnFavorite);
                addfav.Label = "取消订阅";
            }
            foreach (var item in aa.Tags)
            {
                if (item.Length > 0)
                {
                    list_tags.Items.Add(new Tags {
                        Tag = item
                    });
                }
            }
            List <Season_episodes> ep = await ContentServ.GetSeasonResultAsync(url, 3) as List <Season_episodes>;

            if (ep.Count > 0)
            {
                string id_0 = ep[0].ID;
                foreach (var item in ep)
                {
                    if (item.ID == id_0)
                    {
                        continue;
                    }
                    else
                    {
                        foreach (var item1 in ep)
                        {
                            mylist.Items.Add(item1);
                        }
                        break;
                    }
                }
                if (mylist.Items.Count == 0)    //合集
                {
                    isCollection = true;
                    mylist.Items.Add(new Season_episodes {
                        Title = aa.Title, ID = ep[0].ID, Cover = ep[0].Cover
                    });
                }
            }
            List <Season_actor> ac = await ContentServ.GetSeasonResultAsync(url, 2) as List <Season_actor>;

            foreach (var item in ac)
            {
                cvlist.Items.Add(new Actors {
                    Actor = item.Actor, Role = item.Role
                });
            }
            //if (UserHelper.concernList.FindIndex(o => o.ID == sid) != -1)
            //{
            //    addfav.Icon = new SymbolIcon(Symbol.UnFavorite);
            //    addfav.Label = "取消订阅";
            //}
        }
Esempio n. 2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                base.OnNavigatedTo(e);
                sid = e.Parameter.ToString();
                aa  = await ContentServ.GetSeasonResultAsync(sid);

                if (aa == null)
                {
                    return;
                }
                BitmapImage bmp = new BitmapImage();
                Uri         url = new Uri(aa.Cover);
                // var streamReference = RandomAccessStreamReference.CreateFromUri(url);
                // IRandomAccessStream stream = await streamReference.OpenReadAsync();
                // MyImage myimage;
                // if (stream != null)
                // {
                //     BitmapImage img = new BitmapImage(url);
                //     WriteableBitmap bmp = new WriteableBitmap(480, 640);
                //     await bmp.SetSourceAsync(stream);
                //     myimage = new MyImage(bmp);
                //     GaussianBlurFilter filter = new GaussianBlurFilter();
                //     myimage = filter.process(myimage);
                //     pic.Source = myimage.image;
                // }
                bmp.UriSource = url;
                pic.Source    = bmp;
                if (SettingHelper.GetBoolSetting("_blur", true))
                {
                    pic_blur.Source = bmp;
                    if (AnimationExtensions.IsBlurSupported)
                    {
                        pic_blur.Blur(duration: 3000, value: 20).Start();
                    }
                }
                mainitem.Header = aa.Title;
                up.Text         = aa.Copyright;
                desc.Text       = aa.Brief;
                count.Text      = "播放:" + aa.View + "\n" + "订阅:" + aa.Fav + "\n" + "弹幕:" + aa.Danmaku + "\n" + "硬币:" + aa.Coins;
                time.Text       = aa.Time;
                staff.Text      = aa.Staff ?? string.Empty;
                if (aa.CVlist.Count == 0)
                {
                    stk_staff_1.Visibility = Visibility.Collapsed;
                }
                else
                {
                    foreach (Cast item in aa.CVlist)
                    {
                        cvlist.Items.Add(item);
                    }
                }
                if (aa.IsConcerned == "1")
                {
                    addfav.Icon  = new SymbolIcon(Symbol.UnFavorite);
                    addfav.Label = "取消订阅";
                }
                foreach (var item in aa.Tags)
                {
                    if (item.Length > 0)
                    {
                        list_tags.Items.Add(new Tags {
                            Tag = item
                        });
                    }
                }
                List <Episodes> ep = aa.EPS;
                if (ep.Count > 0)
                {
                    string id_0 = ep[0].ID;
                    foreach (var item in ep)
                    {
                        if (item.ID == id_0)
                        {
                            continue;
                        }
                        else
                        {
                            foreach (var item1 in ep)
                            {
                                mylist.Items.Add(item1);
                            }
                            break;
                        }
                    }
                    if (mylist.Items.Count == 0)    // 合集
                    {
                        isCollection = true;
                        mylist.Items.Add(new Episodes {
                            Title = aa.Title + "(合集)", ID = ep[0].ID, Cover = ep[0].Cover
                        });
                    }
                }
                if (SecondaryTile.Exists("tile" + sid))
                {
                    pin.Icon  = new SymbolIcon(Symbol.UnPin);
                    pin.Label = "取消固定";
                    isPinned  = true;
                }
                if (aa.Related != null)
                {
                    if (aa.Related.Count > 1)
                    {
                        list_season.ItemsSource = aa.Related;
                    }
                }
                if (aa.isFinish == false)
                {
                    string day = string.Empty;
                    switch (aa.WeekDay)
                    {
                    case "1": day = "一"; break;

                    case "2": day = "二"; break;

                    case "3": day = "三"; break;

                    case "4": day = "四"; break;

                    case "5": day = "五"; break;

                    case "6": day = "六"; break;

                    case "0": day = "日"; break;
                    }
                    txt_update.Text = day == string.Empty ? string.Empty : "每周" + day + "更新";
                }
                // HyperlinkButton btn = new HyperlinkButton();
                // btn.Command=ne
                // if (UserHelper.concernList.FindIndex(o => o.ID == sid) != -1)
                // {
                //     addfav.Icon = new SymbolIcon(Symbol.UnFavorite);
                //     addfav.Label = "取消订阅";
                // }
            }
            catch
            {
                // 通常的原因:网络连接超时
                await popup.Show("加载失败啦~");
            }
        }