private async void LoadTj() { try { pr_Load.Visibility = Visibility.Visible; _loading = true; if (cursor == "-1") { list_ban_jp_foot.Items.Clear(); } string url = string.Format("https://bangumi.bilibili.com/api/bangumi_recommend?access_key={0}&appkey={1}&build=5250000&cursor={2}&mobi_app=android&pagesize=10&platform=wp&ts={3}000&type=0", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, cursor, ApiHelper.GetTimeSpan); url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResultsUTF8Encode(new Uri(url)); BanTJModel m = JsonConvert.DeserializeObject <BanTJModel>(results); if (m.code == 0) { if (m.result.Count != 0) { m.result.ForEach(x => list_ban_jp_foot.Items.Add(x)); //list_ban_jp_foot.ItemsSource = m.result; cursor = m.result.Last().cursor; } else { Utils.ShowMessageToast("全部加载完...", 2000); } } else { Utils.ShowMessageToast(m.message, 3000); } } catch (Exception ex) { if (ex.HResult == -2147012867 || ex.HResult == -2147012889) { Utils.ShowMessageToast("无法连接服务器,请检查你的网络连接", 3000); } else { Utils.ShowMessageToast("读取推荐信息", 3000); } } finally { _loading = false; pr_Load.Visibility = Visibility.Collapsed; } }
private async void GetBanTJ() { try { LoadBaning = true; Ban_TJ_more.Text = "正在加载..."; wc = new WebClientClass(); string uri = "http://bangumi.bilibili.com/api/bangumi_recommend?_device=wp&appkey=422fd9d7289a1dd9&build=411005&cursor=" + Page_BanTJ + "&pagesize=10&platform=android&ts=" + ApiHelper.GetTimeSpen; uri += "&sign=" + ApiHelper.GetSign(uri); string results = await wc.GetResults(new Uri(uri)); BanTJModel model = JsonConvert.DeserializeObject <BanTJModel>(results); if (model.code == 0) { JObject jo = JObject.Parse(results); List <BanTJModel> list = JsonConvert.DeserializeObject <List <BanTJModel> >(model.result.ToString()); foreach (BanTJModel item in list) { list_Ban_TJ.Items.Add(item); } if (list.Count != 0) { Page_BanTJ = (list[list.Count - 1] as BanTJModel).cursor; Ban_TJ_more.Text = "加载更多"; } else { Ban_TJ_more.Text = "没有更多了..."; } } else { messShow.Show("读取番剧推荐失败!" + model.message, 3000); } } catch (Exception ex) { messShow.Show("读取番剧推荐失败!" + ex.Message, 3000); } finally { LoadBaning = false; pr_Laod.Visibility = Visibility.Collapsed; } }