async void show() { JsonObject json = await BaseService.GetJson("http://bangumi.bilibili.com/jsonp/timeline_v2?_device=wp&_ulv=10000&build=424000&platform=android&appkey=422fd9d7289a1dd9"); if (json.ContainsKey("list")) { var list = json["list"]; if (list != null) { var json2 = list.GetArray(); for (int i = 0; i < json2.Count; i++) { Times time = new Times(); var json3 = JsonObject.Parse(json2[i].ToString()); if (json3.ContainsKey("title")) { time.Title = json3["title"].GetString(); } if (json3.ContainsKey("bgmcount")) { time.Count = StringDeal.delQuotationmarks(json3["bgmcount"].ToString()); } if (json3.ContainsKey("lastupdate_at")) { time.LastUpdate = json3["lastupdate_at"].GetString(); } if (json3.ContainsKey("weekday")) { time.Weekday = json3["weekday"].ToString(); } if (json3.ContainsKey("is_finish")) { time.IsFinish = json3["is_finish"].ToString(); } if (json3.ContainsKey("square_cover")) { time.Cover = json3["square_cover"].GetString(); } if (json3.ContainsKey("new")) { time.IsNew = json3["new"].ToString() == "true" ? true : false; } time.ID = json3["season_id"].ToString(); listview.Items.Add(time); } var groups = from item in listview.Items group item by(item as Times).Weekday; this.cvsData.Source = groups; listview.SelectedIndex = -1; } } }
private async void fav_Click(object sender, RoutedEventArgs e) { if (ApiHelper.IsLogin()) { if (addfav.Label == "订阅") { string url = "http://bangumi.bilibili.com/api/concern_season?_device=wp&_ulv=10000&build=424000&platform=android&appkey=422fd9d7289a1dd9&access_key=" + ApiHelper.accesskey + "&ts=" + ApiHelper.GetLinuxTS().ToString() + "&type=bangumi&season_id=" + sid; url += ApiHelper.GetSign(url); JsonObject json = await BaseService.GetJson(url); if (json.ContainsKey("message")) { if (StringDeal.delQuotationmarks(json["message"].ToString()) == "success") { addfav.Icon = new SymbolIcon(Symbol.UnFavorite); addfav.Label = "取消订阅"; } else { messagepop.Show("订阅失败!" + json["message"].ToString()); } } } else if (addfav.Label == "取消订阅") { string url = "http://bangumi.bilibili.com/api/unconcern_season?_device=wp&_ulv=10000&build=424000&platform=android&appkey=422fd9d7289a1dd9&access_key=" + ApiHelper.accesskey + "&ts=" + ApiHelper.GetLinuxTS().ToString() + "&type=bangumi&season_id=" + sid; url += ApiHelper.GetSign(url); JsonObject json = await BaseService.GetJson(url); if (json.ContainsKey("message")) { if (StringDeal.delQuotationmarks(json["message"].ToString()) == "success") { addfav.Icon = new SymbolIcon(Symbol.Add); addfav.Label = "订阅"; } else { messagepop.Show("取消订阅失败!" + json["message"].ToString()); } } } } }
/// <summary> /// 自动登录 /// </summary> async Task <bool> autologin() { try { if (!SettingHelper.ContainsKey("_accesskey")) { SettingHelper.SetValue("_accesskey", string.Empty); } if (SettingHelper.ContainsKey("_autologin")) { if (bool.Parse(SettingHelper.GetValue("_autologin").ToString()) == true) { string p = string.Empty; string u = string.Empty; if (!string.IsNullOrEmpty(SettingHelper.GetValue("_epassword").ToString())) { p = SettingHelper.GetValue("_epassword").ToString(); } if (!string.IsNullOrEmpty(SettingHelper.GetValue("_username").ToString())) { u = SettingHelper.GetValue("_username").ToString(); } await ApiHelper.login(p, u, false); } } if (ApiHelper.IsLogin()) { ApiHelper.accesskey = SettingHelper.GetValue("_accesskey").ToString(); string url = "http://api.bilibili.com/myinfo?appkey=422fd9d7289a1dd9&access_key=" + SettingHelper.GetValue("_accesskey").ToString(); url += ApiHelper.GetSign(url); JsonObject json = await BaseService.GetJson(url); if (json.ContainsKey("mid")) { UserHelper.mid = json["mid"].ToString(); } if (json.ContainsKey("face")) { face.Fill = new ImageBrush { ImageSource = new BitmapImage(new Uri(StringDeal.delQuotationmarks((json["face"].ToString())))) } } ; if (json.ContainsKey("uname")) { uname.Text = StringDeal.delQuotationmarks(json["uname"].ToString()); } if (json.ContainsKey("level_info")) { JsonObject json2 = JsonObject.Parse(json["level_info"].ToString()); if (json2.ContainsKey("current_level")) { switch (json2["current_level"].ToString()) { case "0": rank.Text = "普通用户"; break; case "1": rank.Text = "注册会员"; break; case "2": rank.Text = "正式会员"; break; case "3": rank.Text = "字幕君"; break; case "4": rank.Text = "VIP用户"; break; case "5": rank.Text = "职人"; break; case "6": rank.Text = "站长大人"; break; } } } } return(true); } catch { return(false); } }
async Task load() { try { if (!isLoaded) { if (SettingHelper.GetValue("_accesskey").ToString().Length > 2) { string url = "http://account.bilibili.com/api/myinfo?access_key=" + ApiHelper.accesskey + "&appkey=" + ApiHelper.appkey + "&platform=wp&type=json"; url += ApiHelper.GetSign(url); JsonObject json = await BaseService.GetJson(url); if (json.ContainsKey("face")) { Face.Source = new BitmapImage { UriSource = new Uri(StringDeal.delQuotationmarks((json["face"].ToString()))) } } ; if (json.ContainsKey("coins")) { coins.Text = "硬币:" + json["coins"].ToString(); } if (json.ContainsKey("sign")) { sign.Text = StringDeal.delQuotationmarks(json["sign"].ToString()); } if (json.ContainsKey("uname")) { userName.Text = StringDeal.delQuotationmarks(json["uname"].ToString()); } if (json.ContainsKey("level_info")) { JsonObject json2 = JsonObject.Parse(json["level_info"].ToString()); if (json2.ContainsKey("next_exp")) { exp_total.Text = json2["next_exp"].ToString(); bar.Maximum = Convert.ToInt32(json2["next_exp"].ToString()); } if (json2.ContainsKey("current_exp")) { exp_current.Text = json2["current_exp"].ToString(); bar.Value = Convert.ToInt32(json2["current_exp"].ToString()); } if (json2.ContainsKey("current_level")) { level.Source = new BitmapImage { UriSource = new Uri("ms-appx:///Assets//Others//lv" + json2["current_level"].ToString() + ".png", UriKind.Absolute) }; } string url2 = "http://space.bilibili.com/ajax/settings/getSettings?mid=" + UserHelper.Mid; JsonObject json_toutu = await BaseService.GetJson(url2); if (json_toutu.ContainsKey("data")) { json_toutu = json_toutu["data"].GetObject(); if (json_toutu.ContainsKey("toutu")) { json_toutu = json_toutu["toutu"].GetObject(); if (json_toutu.ContainsKey("l_img")) { tl = "http://i0.hdslb.com/" + json_toutu["l_img"].GetString(); } if (json_toutu.ContainsKey("s_img")) { ts = "http://i0.hdslb.com/" + json_toutu["s_img"].GetString(); } } } UpDateHeader(); int pagesize = 20; if (SettingHelper.DeviceType == DeviceType.Mobile) { pagesize = 3; width.Width = ActualWidth / 3 - 8; } myFolder = await ContentServ.GetFavFolders(); folderlist.ItemsSource = myFolder; Site_Concern concern = await UserRelated.GetConcernBangumiAsync("", 1, true, pagesize); if (concern != null) { concern_count.Text = concern.Count; conlist.ItemsSource = concern.Result; } isLoaded = true; } } } } catch (Exception) { } }
async void load() { try { if (SettingHelper.GetValue("_accesskey").ToString().Length > 2) { string url = "http://api.bilibili.com/myinfo?appkey=" + ApiHelper.appkey + "&access_key=" + ApiHelper.accesskey; url += ApiHelper.GetSign(url); JsonObject json = await BaseService.GetJson(url); if (json.ContainsKey("face")) { Face.Source = new BitmapImage { UriSource = new Uri(StringDeal.delQuotationmarks((json["face"].ToString()))) } } ; if (json.ContainsKey("coins")) { coins.Text += json["coins"].ToString(); } if (json.ContainsKey("sign")) { sign.Text = StringDeal.delQuotationmarks(json["sign"].ToString()); } if (json.ContainsKey("uname")) { userName.Text = StringDeal.delQuotationmarks(json["uname"].ToString()); } if (json.ContainsKey("level_info")) { JsonObject json2 = JsonObject.Parse(json["level_info"].ToString()); if (json2.ContainsKey("next_exp")) { exp_total.Text = json2["next_exp"].ToString(); bar.Maximum = Convert.ToInt32(json2["next_exp"].ToString()); } if (json2.ContainsKey("current_exp")) { exp_current.Text = json2["current_exp"].ToString(); bar.Value = Convert.ToInt32(json2["current_exp"].ToString()); } if (json2.ContainsKey("current_level")) { level.Source = new BitmapImage { UriSource = new Uri("ms-appx:///Assets//Others//lv" + json2["current_level"].ToString() + ".png", UriKind.Absolute) }; } } } myFolder = await ContentServ.GetFavFolders(); foreach (var item in await ContentServ.GetConAsync(1)) { conlist.Items.Add(item); } int count = 0; foreach (var item in myFolder) { count += int.Parse(item.Count); } if (count == 0) { fav.Content += "(暂无收藏)"; } } catch { } }