private void btn_Play_Click(object sender, RoutedEventArgs e) { if (list_E.Items.Count <= 0) { messShow.Show("没有内容...无法播放...", 3000); return; } BangumiInfoModel model = (BangumiInfoModel)list_E.Items[0]; if (model.inLocal) { if ((bool)settings.GetSettingValue("PlayLocal")) { this.Frame.Navigate(typeof(DownloadPage), 1); return; } } List <VideoModel> listVideo = new List <VideoModel>(); List <BangumiInfoModel> ls = ((List <BangumiInfoModel>)list_E.ItemsSource).OrderByDescending(s => Convert.ToDouble(s.Num)).ToList(); foreach (BangumiInfoModel item in ls) { listVideo.Add(new VideoModel() { aid = item.av_id, title = txt_Name.Text, cid = item.danmaku.ToString(), page = item.index, part = item.index_title ?? "" }); } KeyValuePair <List <VideoModel>, int> list = new KeyValuePair <List <VideoModel>, int>(listVideo, 0); PostHistory(model.av_id); this.Frame.Navigate(typeof(PlayerPage), list); }
private async void grid_E_ItemClick(object sender, ItemClickEventArgs e) { if (cb_IsPlay.IsChecked.Value) { BangumiInfoModel model = e.ClickedItem as BangumiInfoModel; if (model.inLocal) { if ((bool)settings.GetSettingValue("PlayLocal")) { this.Frame.Navigate(typeof(DownloadPage), 1); return; } } List <VideoModel> listVideo = new List <VideoModel>(); List <BangumiInfoModel> ls = ((List <BangumiInfoModel>)list_E.ItemsSource).OrderByDescending(s => Convert.ToDouble(s.Num)).ToList(); foreach (BangumiInfoModel item in ls) { listVideo.Add(new VideoModel() { aid = item.av_id, title = txt_Name.Text, cid = item.danmaku.ToString(), page = item.index, part = item.index_title ?? "" }); } KeyValuePair <List <VideoModel>, int> list = new KeyValuePair <List <VideoModel>, int>(listVideo, ls.IndexOf(e.ClickedItem as BangumiInfoModel)); PostHistory(model.av_id); this.Frame.Navigate(typeof(PlayerPage), list); } else { this.Frame.Navigate(typeof(VideoInfoPage), (e.ClickedItem as BangumiInfoModel).av_id); } }
private async void LoadAnimeInfo() { try { Loading.IsVisible = true; //var str = await Api._BanInfoApi(_sid).GetStringAsync(); var eresults = await Api._BanInfoApi2(_sid).GetStringAsync(); // str1 = str1.Replace("seasonListCallback(", ""); // str1 = str1.Remove(str1.Length-2,2); BangumiInfoModel model = JsonConvert.DeserializeObject <BangumiInfoModel>(eresults); if (model.code == 0) { BindingContext = model.result; if (model.result.title.Contains("僅")) { _videoType = VideoType.AreaAnime; await DisplayAlert("说明", "你下载的是地区专供番,将会调用系统下载", "知道了"); } Util.SaveHistroy(new HistroyModel() { date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), id = _sid, name = model.result.title, type = "anime" }); } else { Util.ShowShortToast("加载失败,请检查网址是否正确"); } } catch (Exception ex) { await DisplayAlert("读取失败", ex.Message, "OK"); } finally { Loading.IsVisible = false; } }
private async void LoadAnimeInfo() { try { Loading.IsVisible = true; var eresults = await HttpHelper.GetStringAsync(Api._BanInfoApi2(_sid)); BangumiInfoModel model = JsonConvert.DeserializeObject <BangumiInfoModel>(eresults); if (model.code == 0) { BindingContext = model.result; if (model.result.title.Contains("僅")) { _videoType = VideoType.AreaAnime; await DisplayAlert("说明", "该番是地区限制番,将会调用系统下载\r\n调用系统下载时清晰度设置无效\r\n请等待系统下载视频完毕后重启哔哩哔哩", "知道了"); } Util.SaveHistroy(new HistroyModel() { date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), id = _sid, name = model.result.title, type = "anime" }); } else { Util.ShowShortToast("加载失败,请检查网址是否正确"); } } catch (Exception ex) { await DisplayAlert("读取失败", ex.Message, "OK"); } finally { Loading.IsVisible = false; } }
private void grid_E_ItemClick(object sender, ItemClickEventArgs e) { if (cb_IsPlay.IsChecked.Value) { BangumiInfoModel model = e.ClickedItem as BangumiInfoModel; List <VideoInfoModel> listVideo = new List <VideoInfoModel>(); List <BangumiInfoModel> ls = ((List <BangumiInfoModel>)list_E.ItemsSource).OrderBy(s => Convert.ToDouble(s.index)).ToList(); foreach (BangumiInfoModel item in ls) { listVideo.Add(new VideoInfoModel() { aid = item.av_id, title = item.index_title ?? item.index, cid = item.danmaku.ToString(), page = item.index, part = item.index_title ?? "" }); } KeyValuePair <List <VideoInfoModel>, int> list = new KeyValuePair <List <VideoInfoModel>, int>(listVideo, ls.IndexOf(e.ClickedItem as BangumiInfoModel)); //VplayVideo(list); } else { this.Frame.Navigate(typeof(VideoInfoPage), (e.ClickedItem as BangumiInfoModel).av_id); } }
public async void GetBangumiInfo(string banID) { //string uri = "http://bangumi.bilibili.com/api/season?_device=wp&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts="+APIHelper.GetTimeSpen+ "000&type=sp&sp_id=56719"; //string sign= APIHelper.GetSign(uri); //uri += "&sign=" + sign; try { pr_load.Visibility = Visibility.Visible; wc = new WebClientClass(); string uri = ""; uri = string.Format("http://bangumi.bilibili.com/api/season?_device=wp&access_key={2}&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts={0}000&type=bangumi&season_id={1}", ApiHelper.GetTimeSpen, banID, ApiHelper.access_key); uri += "&sign=" + ApiHelper.GetSign(uri); string result = await wc.GetResults(new Uri(uri)); BangumiInfoModel model = new BangumiInfoModel(); if ((int)JObject.Parse(result)["code"] == 0) { model = JsonConvert.DeserializeObject<BangumiInfoModel>(JObject.Parse(result)["result"].ToString()); grid_Info.DataContext = model; BangumiInfoModel m = JsonConvert.DeserializeObject<BangumiInfoModel>(model.user_season.ToString()); if (m.attention == 0) { font_icon.Glyph = "\uE006"; btn_concern.Label = "订阅"; } else { font_icon.Glyph = "\uE00B"; btn_concern.Label = "取消订阅"; } List<BangumiInfoModel> list = JsonConvert.DeserializeObject<List<BangumiInfoModel>>(model.episodes.ToString()); List<BangumiInfoModel> list2 = new List<BangumiInfoModel>(); for (int i = 0; i < list.Count; i++) { list[i].Num = i; list2.Add(list[i]); if (DownloadManage.Downloaded.Contains(list[i].danmaku.ToString())) { list[i].inLocal = true; } } list_E.ItemsSource = list2; List<BangumiInfoModel> list_CV = JsonConvert.DeserializeObject<List<BangumiInfoModel>>(model.actor.ToString()); txt_CV.Text = ""; foreach (BangumiInfoModel item in list_CV) { txt_CV.Text += string.Format("{0}:{1}\r\n", item.role, item.actor); } List<BangumiInfoModel> list_Tag = JsonConvert.DeserializeObject<List<BangumiInfoModel>>(model.tags.ToString()); Grid_tag.Children.Clear(); foreach (BangumiInfoModel item in list_Tag) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.tag_name; btn.Click += Btn_Click; Grid_tag.Children.Add(btn); } } if ((int)JObject.Parse(result)["code"] == -3) { messShow.Show("密钥注册失败,请联系作者",3000); } if ((int)JObject.Parse(result)["code"] == 10) { messShow.Show(JObject.Parse(result)["message"].ToString(), 3000); } } catch (Exception ex) { messShow.Show("发生错误\r\n" + ex.Message, 3000); } finally { pr_load.Visibility = Visibility.Collapsed; } }
public async void GetBangumiInfo(string banID) { //string uri = "http://bangumi.bilibili.com/api/season?_device=wp&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts="+APIHelper.GetTimeSpen+ "000&type=sp&sp_id=56719"; //string sign= APIHelper.GetSign(uri); //uri += "&sign=" + sign; try { pr_load.Visibility = Visibility.Visible; wc = new WebClientClass(); string uri = ""; uri = string.Format("http://bangumi.bilibili.com/api/season?_device=wp&access_key={2}&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts={0}000&type=bangumi&season_id={1}", ApiHelper.GetTimeSpen, banID, ApiHelper.access_key); uri += "&sign=" + ApiHelper.GetSign(uri); string result = await wc.GetResults(new Uri(uri)); BangumiInfoModel model = new BangumiInfoModel(); if ((int)JObject.Parse(result)["code"] == 0) { model = JsonConvert.DeserializeObject <BangumiInfoModel>(JObject.Parse(result)["result"].ToString()); grid_Info.DataContext = model; BangumiInfoModel m = JsonConvert.DeserializeObject <BangumiInfoModel>(model.user_season.ToString()); if (m.attention == 0) { font_icon.Glyph = "\uE006"; btn_concern.Label = "订阅"; } else { font_icon.Glyph = "\uE00B"; btn_concern.Label = "取消订阅"; } List <BangumiInfoModel> list = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.episodes.ToString()); List <BangumiInfoModel> list2 = new List <BangumiInfoModel>(); for (int i = 0; i < list.Count; i++) { list[i].Num = i; list2.Add(list[i]); if (DownloadManage.Downloaded.Contains(list[i].danmaku.ToString())) { list[i].inLocal = true; } } list_E.ItemsSource = list2; List <BangumiInfoModel> list_CV = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.actor.ToString()); txt_CV.Text = ""; foreach (BangumiInfoModel item in list_CV) { txt_CV.Text += string.Format("{0}:{1}\r\n", item.role, item.actor); } List <BangumiInfoModel> list_Tag = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.tags.ToString()); Grid_tag.Children.Clear(); foreach (BangumiInfoModel item in list_Tag) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.tag_name; btn.Click += Btn_Click; Grid_tag.Children.Add(btn); } } if ((int)JObject.Parse(result)["code"] == -3) { messShow.Show("密钥注册失败,请联系作者", 3000); } if ((int)JObject.Parse(result)["code"] == 10) { messShow.Show(JObject.Parse(result)["message"].ToString(), 3000); } } catch (Exception ex) { messShow.Show("发生错误\r\n" + ex.Message, 3000); } finally { pr_load.Visibility = Visibility.Collapsed; } }
private async void GetInfo() { try { pr_Load.Visibility = Visibility.Visible; string uri = string.Format("http://bangumi.bilibili.com/api/season_v3?_device=wp&access_key={2}&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts={0}000&type=bangumi&season_id={1}", ApiHelper.GetTimeSpan, _banId, ApiHelper.access_key); uri += "&sign=" + ApiHelper.GetSign(uri); string results = ""; if (SettingHelper.Get_UseCN() || SettingHelper.Get_UseHK() || SettingHelper.Get_UseTW()) { results = await WebClientClass.GetResults_Proxy(uri); } else { results = await WebClientClass.GetResults(new Uri(uri)); } // string results = await WebClientClass.GetResults(new Uri(uri)); BangumiInfoModel model = JsonConvert.DeserializeObject <BangumiInfoModel>(results); if (model.code == 0) { int i = 0; model.result.episodes.ForEach(x => { x.orderindex = i; i++; }); model.result.episodes = model.result.episodes.OrderByDescending(x => x.orderindex).ToList(); this.DataContext = model.result; gv_Play.ItemsSource = model.result.episodes; if (model.result.user_season.attention == 0) { btn_Like.Visibility = Visibility.Visible; btn_CancelLike.Visibility = Visibility.Collapsed; } else { btn_Like.Visibility = Visibility.Collapsed; btn_CancelLike.Visibility = Visibility.Visible; } if (model.result.rank != null) { BangumiInfoModel rank = JsonConvert.DeserializeObject <BangumiInfoModel>(model.result.rank.ToString()); grid_Cb.DataContext = rank; grid_Cb.Visibility = Visibility.Visible; txt_NotCb.Visibility = Visibility.Collapsed; GetRankInfo(); } else { txt_NotCb.Visibility = Visibility.Visible; grid_Cb.Visibility = Visibility.Collapsed; } if (model.result.seasons != null) { Grid_About.Visibility = Visibility.Visible; WrapPanel_About.Children.Clear(); if (model.result.seasons.Count == 1) { Grid_About.Visibility = Visibility.Collapsed; } else { foreach (BangumiInfoModel item in model.result.seasons) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.title; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; if (item.season_id == _banId) { btn.IsEnabled = false; } btn.Click += Btn_Click;; WrapPanel_About.Children.Add(btn); } } //Grid_About } else { Grid_About.Visibility = Visibility.Collapsed; } if (model.result.tags != null) { WrapPanel_tag.Children.Clear(); foreach (var item in model.result.tags) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.tag_name; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; btn.Click += Btn_Click1;; WrapPanel_tag.Children.Add(btn); } } if (gv_Play.Items.Count != 0) { cb_H.SelectedIndex = cb_H.Items.Count - 1; gv_Play.SelectedIndex = 0; } else { messShow.Show("尚未开播或不支持你所在地区", 3000); } } else { messShow.Show(model.message, 3000); } } catch (Exception ex) { if (ex.HResult == -2147012867) { messShow.Show("检查你的网络连接!", 3000); } else { messShow.Show("发生错误\r\n" + ex.Message, 3000); } } finally { Page_SizeChanged(null, null); btn_HideAll_Click(null, null); pr_Load.Visibility = Visibility.Collapsed; } }
public async void GetBangumiInfo(string banID) { //string uri = "http://bangumi.bilibili.com/api/season?_device=wp&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts="+APIHelper.GetTimeSpen+ "000&type=sp&sp_id=56719"; //string sign= APIHelper.GetSign(uri); //uri += "&sign=" + sign; try { pr_load.Visibility = Visibility.Visible; wc = new WebClientClass(); string uri = ""; uri = string.Format("http://bangumi.bilibili.com/api/season_v3?_device=wp&access_key={2}&_ulv=10000&build=411005&platform=android&appkey=422fd9d7289a1dd9&ts={0}000&type=bangumi&season_id={1}", ApiHelper.GetTimeSpen, banID, ApiHelper.access_key); uri += "&sign=" + ApiHelper.GetSign(uri); string area = ""; string result = ""; if (useHkIp) { area = "hk"; } if (userTwIp) { area = "tw"; } if (userDlIp) { area = "cn"; } if (!userDlIp && !userTwIp && !useHkIp) { result = await wc.GetResults(new Uri(uri)); } else { string re = await wc.GetResults(new Uri("http://52uwp.com/api/BiliBili?area=" + area + "&url=" + Uri.EscapeDataString(uri))); MessageModel ms = JsonConvert.DeserializeObject <MessageModel>(re); if (ms.code == 0) { result = ms.message; } if (ms.code == -100) { await new MessageDialog("远程代理失效,请联系开发者更新!").ShowAsync(); } if (ms.code == -200) { await new MessageDialog("代理读取信息失败,请重试!").ShowAsync(); } } BangumiInfoModel model = new BangumiInfoModel(); if ((int)JObject.Parse(result)["code"] == 0) { model = JsonConvert.DeserializeObject <BangumiInfoModel>(JObject.Parse(result)["result"].ToString()); grid_Info.DataContext = model; BangumiInfoModel m = JsonConvert.DeserializeObject <BangumiInfoModel>(model.user_season.ToString()); if (m.attention == 0) { font_icon.Glyph = "\uE006"; btn_concern.Label = "订阅"; } else { font_icon.Glyph = "\uE00B"; btn_concern.Label = "取消订阅"; } if (model.rank != null) { BangumiInfoModel rank = JsonConvert.DeserializeObject <BangumiInfoModel>(model.rank.ToString()); grid_Cb.DataContext = rank; grid_Cb.Visibility = Visibility.Visible; txt_NotCb.Visibility = Visibility.Collapsed; GetRankInfo(); } else { txt_NotCb.Visibility = Visibility.Visible; grid_Cb.Visibility = Visibility.Collapsed; } if (model.seasons != null) { Grid_About.Visibility = Visibility.Visible; List <BangumiInfoModel> seasons = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.seasons.ToString()); WrapPanel_About.Children.Clear(); if (seasons.Count == 1) { Grid_About.Visibility = Visibility.Collapsed; } else { foreach (BangumiInfoModel item in seasons) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.title; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; if (item.season_id == banID) { btn.IsEnabled = false; } btn.Click += Btn_Click1; WrapPanel_About.Children.Add(btn); } } //Grid_About } else { Grid_About.Visibility = Visibility.Collapsed; } SqlHelper sql = new SqlHelper(); List <BangumiInfoModel> list = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.episodes.ToString()); List <BangumiInfoModel> list2 = new List <BangumiInfoModel>(); for (int i = 0; i < list.Count; i++) { list[i].Num = i; if (sql.ValuesExists(list[i].danmaku.ToString())) { list[i].color = new SolidColorBrush() { Color = Colors.Gray }; } else { list[i].color = new SolidColorBrush() { Color = Colors.White }; } if (DownloadManage.Downloaded.Contains(list[i].danmaku.ToString())) { list[i].inLocal = true; } list2.Add(list[i]); } list_E.ItemsSource = list2; cb_H.ItemsSource = list2; List <BangumiInfoModel> list_CV = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.actor.ToString()); txt_CV.Text = ""; foreach (BangumiInfoModel item in list_CV) { txt_CV.Text += string.Format("{0}:{1}\r\n", item.role, item.actor); } List <BangumiInfoModel> list_Tag = JsonConvert.DeserializeObject <List <BangumiInfoModel> >(model.tags.ToString()); Grid_tag.Children.Clear(); foreach (BangumiInfoModel item in list_Tag) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.tag_name; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; btn.Click += Btn_Click; Grid_tag.Children.Add(btn); } if (list_E.Items.Count != 0) { GetVideoComment_Hot(list2[0].av_id); cb_H.SelectedIndex = 0; } } if ((int)JObject.Parse(result)["code"] == -3) { messShow.Show("密钥注册失败,请联系作者", 3000); } if ((int)JObject.Parse(result)["code"] == 10) { messShow.Show(JObject.Parse(result)["message"].ToString(), 3000); } } catch (Exception ex) { if (ex.HResult == -2147012867) { messShow.Show("检查你的网络连接!", 3000); } else { messShow.Show("发生错误\r\n" + ex.Message, 3000); } } finally { pr_load.Visibility = Visibility.Collapsed; } }
private async void GetInfo() { try { pr_Load.Visibility = Visibility.Visible; string uri = string.Format("https://bangumi.bilibili.com/view/api/season?access_key={0}&appkey={1}&build=5250000&platform=android&season_id={2}&ts={3}", ApiHelper.access_key, ApiHelper._appKey, _banId, ApiHelper.GetTimeSpan); uri += "&sign=" + ApiHelper.GetSign(uri); string results = await WebClientClass.GetResultsUTF8Encode(new Uri(uri)); BangumiDataModel model = JsonConvert.DeserializeObject <BangumiDataModel>(results); // string results = await WebClientClass.GetResults(new Uri(uri)); if (model.code == 0 || model.code == -404) { if (model.code == -404) { string eresults = await WebClientClass.GetResultsUTF8Encode(new Uri("https://bangumi.bilibili.com/view/web_api/season?season_id=" + _banId)); eresults = eresults.Replace("ep_id", "episode_id"); eresults = eresults.Replace("cid", "danmaku"); eresults = eresults.Replace("aid", "av_id"); model = JsonConvert.DeserializeObject <BangumiDataModel>(eresults); if (model.code != 0) { Utils.ShowMessageToast(model.message, 3000); return; } } else { if (results.Contains("僅") && results.Contains("地區") && (model.result.episodes == null || model.result.episodes.Count == 0)) { //results = await WebClientClass.GetResultsUTF8Encode(new Uri("http://bangumi.bilibili.com/jsonp/seasoninfo/"+ _banId + ".ver?callback=seasonListCallback&jsonp=jsonp&_=")); //results = results.Replace("seasonListCallback(", ""); //results = results.Remove(results.Length-2,2); string eresults = await WebClientClass.GetResultsUTF8Encode(new Uri("https://bangumi.bilibili.com/view/web_api/season?season_id=" + _banId)); eresults = eresults.Replace("ep_id", "episode_id"); eresults = eresults.Replace("cid", "danmaku"); eresults = eresults.Replace("aid", "av_id"); List <episodesModel> ep = JsonConvert.DeserializeObject <List <episodesModel> >(JObject.Parse(eresults)["result"]["episodes"].ToString()); model.result.episodes = ep; } } int i = 0; model.result.episodes.ForEach(x => { x.orderindex = i; i++; }); model.result.episodes = model.result.episodes.OrderByDescending(x => x.orderindex).ToList(); model.result.detail = await GetDetail(model.result.media_id.ToString()); this.DataContext = model.result; gv_Play.ItemsSource = model.result.episodes; if (model.result.user_status != null && model.result.user_status.follow != 0) { btn_Like.Visibility = Visibility.Collapsed; btn_CancelLike.Visibility = Visibility.Visible; if (model.result.user_status.watch_progress != null && model.result.user_status.watch_progress.last_ep_index != "") { last_view.Text = "(上次看到" + model.result.user_status.watch_progress.last_ep_index + "话)"; } else { last_view.Text = ""; } } else { btn_Like.Visibility = Visibility.Visible; btn_CancelLike.Visibility = Visibility.Collapsed; } if (model.result.rank != null) { BangumiInfoModel rank = JsonConvert.DeserializeObject <BangumiInfoModel>(model.result.rank.ToString()); grid_Cb.DataContext = rank; grid_Cb.Visibility = Visibility.Visible; txt_NotCb.Visibility = Visibility.Collapsed; GetRankInfo(); } else { txt_NotCb.Visibility = Visibility.Visible; grid_Cb.Visibility = Visibility.Collapsed; } if (model.result.seasons != null && model.result.seasons.Count != 0) { Grid_About.Visibility = Visibility.Visible; WrapPanel_About.Children.Clear(); if (model.result.seasons.Count == 1) { Grid_About.Visibility = Visibility.Collapsed; } else { foreach (BangumiseasonsModel item in model.result.seasons) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.title; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; if (item.season_id.ToString() == _banId) { btn.IsEnabled = false; } btn.Click += Btn_Click;; WrapPanel_About.Children.Add(btn); } } //Grid_About } else { Grid_About.Visibility = Visibility.Collapsed; } if (model.result.detail.style != null) { WrapPanel_tag.Children.Clear(); foreach (var item in model.result.detail.style) { HyperlinkButton btn = new HyperlinkButton(); btn.DataContext = item; btn.Margin = new Thickness(0, 0, 10, 0); btn.Content = item.name; btn.Foreground = App.Current.Resources["Bili-ForeColor"] as SolidColorBrush; btn.Click += Btn_Click1;; WrapPanel_tag.Children.Add(btn); } } if (gv_Play.Items.Count != 0) { cb_H.SelectedIndex = gv_Play.Items.Count - 1; gv_Play.SelectedIndex = 0; } else { Utils.ShowMessageToast("尚未开播或不支持你所在地区", 3000); } } else { Utils.ShowMessageToast(model.message, 3000); } } catch (Exception ex) { if (ex.HResult == -2147012867) { Utils.ShowMessageToast("检查你的网络连接!", 3000); } else { Utils.ShowMessageToast("发生错误\r\n" + ex.Message, 3000); } } finally { Page_SizeChanged(null, null); btn_HideAll_Click(null, null); pr_Load.Visibility = Visibility.Collapsed; } }