我目前正在尝试为我的Instagram应用程序添加分页并设法替换提供数据源的List以及新数据,但我想将其添加到现有List中,以便当我向后滚动它时显示最新图片。这是我现在的方法:
var request = new RestRequest { RootElement = "data", Resource = "/users/self/feed" };
request.AddParameter ("access_token", instagramAccessToken);
var client = new RestClient ("https://api.instagram.com/v1");
client.ExecuteAsync (request, response => {
var rootObject = JsonConvert.DeserializeObject<RootObject> (response.Content);
string nextURL = rootObject.pagination.next_url;
//// Create Next Client
var requestBack = new RestRequest ();
var clientBack = new RestClient (nextURL);
// GET Next Response
clientBack.ExecuteAsync(requestBack, responseBack => {
var rootObjectBack = JsonConvert.DeserializeObject<RootObject> (responseBack.Content);
table.InvokeOnMainThread (() => {
// Create list that contains newly attained JSON
List<Datum> instagramData = rootObjectBack.data;
// Create dummy list for other values
List<Datum> sloppy = null;
// Send list that contains data, and the sloppy which doesnt contain anything to the Facebook and Twitter Values.
table.Source = new TableSource<Datum>(instagramData, sloppy, sloppy);
table.ReloadData ();
});
});
});
答案 0 :(得分:2)
List<x> A = initial data
List<x> B = new data
A.AddRange(B);
A现在已将B附加到结尾
访问现有资源中的公共列表(假设它名为“数据”)
((TableSource<Datum>)table.Source).Data