async void load(string mid) { if (mid.Length == 0) { foreach (var item in await ContentServ.GetConAsync(1)) { conlist.Items.Add(item); conlist2.Items.Add(item); } } else { foreach (var item in await ContentServ.GetFriendsCons(mid, 1)) { conlist.Items.Add(item); conlist2.Items.Add(item); } } if (conlist.Items.Count < 20) { var text1 = Load.FindChildOfType <TextBlock>(conlist); text1.Text = "加载完毕!"; } con.Text += conlist.Items.Count == 0 ? "(暂无订阅)" : ""; isConcernLoad = true; }
private void GridView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { Type type = sender.GetType(); ListViewBase view; if (type.Name == "GridView") { view = sender as GridView; } else { view = sender as ListView; } var scroll = Load.FindChildOfType <ScrollViewer>(view); var text = Load.FindChildOfType <TextBlock>(view); scroll.ViewChanged += async(s, a) => { if (scroll.VerticalOffset >= scroll.ScrollableHeight - 50 && !isLoading) { text.Visibility = Visibility.Visible; int count0 = view.Items.Count; int page = view.Items.Count / 20 + 1; isLoading = true; List <Concern> temps = await ContentServ.GetConAsync(page); text.Visibility = Visibility.Collapsed; foreach (var item in temps) { view.Items.Add(item); } if (temps.Count < 30) { text.Text = "装填完毕!"; return; } isLoading = false; } }; }
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 { } }