Example #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                base.OnNavigatedTo(e);
                SwitchCommandBar(false);
                desc.Visibility = Visibility.Visible;
                aid             = e.Parameter.ToString();
                string url = "http://app.bilibili.com/x/view?_device=android&_ulv=10000&plat=0&build=424000&aid=" + aid + "&appkey=" + ApiHelper.appkey + "&access_key=" + ApiHelper.accesskey;
                url    += ApiHelper.GetSign(url);
                details = await ContentServ.GetDetailsAsync(url);

                if (details != null)
                {
                    pageNavi("AV" + details.Aid);
                    BitmapImage bmp = new BitmapImage()
                    {
                        UriSource = new Uri(details.Pic)
                    };
                    pic.Source = bmp;
                    if (SettingHelper.GetBoolSetting("_blur", true))
                    {
                        pic_blur.Source = bmp;
                        if (AnimationExtensions.IsBlurSupported)
                        {
                            pic_blur.Blur(duration: 3000, value: 20).Start();
                        }
                    }
                    title.Text     = details.Title;
                    up.Content     = details.Upzhu;
                    desc.Text      = details.Desc;
                    c_play.Text    = "播放:" + details.View + '\t';
                    c_fav.Text     = "收藏:" + details.Fav + '\t';
                    c_danmaku.Text = "弹幕:" + details.Danmu + '\t';
                    c_coin.Text    = "硬币:" + details.Coins + '\t';
                    c_comment.Text = "评论:" + details.Reply + '\t';
                    time.Text      = details.Time;
                    if (details.IsFav == "1")
                    {
                        btn_addfav.Icon  = new SymbolIcon(Symbol.UnFavorite);
                        btn_addfav.Label = "取消收藏";
                    }
                    foreach (var item in details.Tags)
                    {
                        if (item.Length > 0)
                        {
                            list_tags.Items.Add(new Tags {
                                Tag = item
                            });
                        }
                    }
                    foreach (var item in details.Ps)
                    {
                        ReadyList.Items.Add(item);
                    }
                    if (!string.IsNullOrEmpty(details.Sid))
                    {
                        bangumi.Content        = details.BangumiTitle;
                        bangumi.Click         += Bangumi_Click;
                        stk_bangumi.Visibility = Visibility.Visible;
                    }
                    // if (UserHelper.concernList.FindIndex(o => o.ID == cid) != -1)
                    // {
                    //     btn_addfav.Icon = new SymbolIcon(Symbol.UnFavorite);
                    //     btn_addfav.Label = "取消收藏";
                    // }
                    if (SettingHelper.ContainsKey("_quality"))
                    {
                        (FindName("q" + SettingHelper.GetValue("_quality").ToString()) as RadioButton).IsChecked = true;
                        quality = SettingHelper.GetValue("_quality").ToString();
                    }
                    if (SettingHelper.ContainsKey("_videoformat"))
                    {
                        (FindName("f" + SettingHelper.GetValue("_videoformat").ToString()) as RadioButton).IsChecked = true;
                    }
                }
                else
                {
                    await popup.Show("视频不存在或已被删除");
                }
            }
            catch
            {
                await popup.Show("加载失败啦~");
            }
        }
Example #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("加载失败啦~");
            }
        }