private void ParseResponse(ListGroupsFacebookResponse jsonresponse) { foreach (var group in jsonresponse.data) { SocialShareGroups.Add(ParseGroupData(group)); } }
private void ProcessNextPage(ListGroupsFacebookResponse jsonresponse) { if (jsonresponse == null || jsonresponse.paging == null || string.IsNullOrEmpty(jsonresponse.paging.next)) { return; } ListGroupsFacebookResponse jsonPageResponse; using (WebClient client = new WebClient()) { client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); using (Stream data = client.OpenRead(jsonresponse.paging.next)) { using (StreamReader reader = new StreamReader(data)) { string response = reader.ReadToEnd(); if (IsDebug) { Console.WriteLine(response); } jsonPageResponse = JsonConvert.DeserializeObject <ListGroupsFacebookResponse>(response); data.Close(); reader.Close(); } } } ParseResponse(jsonPageResponse); if (jsonPageResponse.paging != null && !string.IsNullOrEmpty(jsonPageResponse.paging.next)) { ProcessNextPage(jsonPageResponse); } }