我使用uwp windown 10使应用程序不闪屏,但响应有限=30。我无法获得全部。非常感谢你
public static ObservableCollection<RootObject> listNewImage = new ObservableCollection<RootObject>();
PublicAuthorization publicAuthorization = new PublicAuthorization();
listNewImage = await publicAuthorization.Authorization();
while (listNewImage.Count > RequestParameters.perpage)
{
await Task.Delay(10);
RequestParameters.page += 30;
RequestParameters.perpage += 30;
listNewImage = await publicAuthorization.Authorization();
}
public async Task<ObservableCollection<RootObject>> Authorization()
{
Uri auUri = new Uri(RequestParameters.publicAuUri);
HttpClient httpClient = new HttpClient();
string responseJson = await httpClient.GetStringAsync(auUri);
ObservableCollection<RootObject> listNewImage = JsonConvert.DeserializeObject<ObservableCollection<RootObject>>(responseJson, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
return listNewImage;
}
答案 0 :(得分:0)
如前所述,API根据per_page
查询参数限制了结果数量。如果增加此数字,将获得更多结果。然后,如果要获取单个页面,则只需增加page
参数即可获取下一页。您的代码当前在page
和per_page
参数中添加了30,相反,您需要做类似的事情。 per_page
应该保持不变,而您只是在请求下一页。
RequestParameters.page++;