private async void LoadMoreClick(object sender, RoutedEventArgs e) { (Application.Current as App).currentPage++; string url = "https://api.tuchong.com/feed-app?post_id=" + (Application.Current as App).lastPostId + "&page=" + (Application.Current as App).currentPage.ToString() + "&type=loadmore"; var MineItems = await TuchongHelper.GetTuchongImage(url); await AddtoGridView(MineItems); }
private async Task GetFirstData() { string url = "https://api.tuchong.com/feed-app"; _mine = await TuchongHelper.GetTuchongImage(url); (Application.Current as App).lastPostId = _mine[_mine.Count - 1].post_id; }
public async Task <IEnumerable <TuchongImageMine> > GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = default(CancellationToken)) { IEnumerable <TuchongImageMine> result = null; (Application.Current as App).currentPage++; ObservableCollection <TuchongImageMine> MineItems = new ObservableCollection <TuchongImageMine>(); string url = ""; if ((Application.Current as App).bRefresh) { url = "https://api.tuchong.com/feed-app"; } else { url = "https://api.tuchong.com/feed-app?post_id=" + (Application.Current as App).lastPostId + "&page=" + (Application.Current as App).currentPage.ToString() + "&type=loadmore"; } MineItems = await TuchongHelper.GetTuchongImage(url); foreach (var item in MineItems) { if ((Application.Current as App).toShowItems.Contains(item)) { continue; } (Application.Current as App).toShowItems.Add(item); _mine.Add(item); await Task.Delay(50); } (Application.Current as App).lastPostId = MineItems[MineItems.Count - 1].post_id; (Application.Current as App).bRefresh = false; result = (Application.Current as App).toShowItems.AsEnumerable <TuchongImageMine>(); return(result); }
private async Task GetRecommend() { var MineItems = await TuchongHelper.GetTuchongImage("https://api.tuchong.com/feed-app"); await AddtoGridView(MineItems); }