Esempio n. 1
0
 public static SearchEntity ParseStatuses(string statuses, string searchMetaData,
     UserAccountEntity userAccountEntity)
 {
     if (statuses == null) throw new ArgumentNullException("statuses");
     JArray statusList = JArray.Parse(statuses);
     JObject searchMeta = JObject.Parse(searchMetaData);
     var searchEntity = new SearchEntity
     {
         PostList = statusList != null ? PostEntity.Parse(statusList.ToString(), userAccountEntity) : null,
         CompletedIn = searchMeta["completed_in"] != null ? (Decimal) searchMeta["completed_in"] : 0,
         MaxId = searchMeta["max_id"] != null ? long.Parse((String) searchMeta["max_id"]) : 0,
         MaxIdStr = searchMeta["max_id_str"] != null ? (String) searchMeta["max_id_str"] : string.Empty,
         SinceId = searchMeta["since_id"] != null ? long.Parse((String) searchMeta["since_id"]) : 0,
         SinceIdStr = searchMeta["since_id_str"] != null ? (String) searchMeta["since_id_str"] : string.Empty,
         Count = searchMeta["count"] != null ? (int) searchMeta["count"] : 0,
         NextResults = searchMeta["next_results"] != null ? (String) searchMeta["next_results"] : string.Empty,
         RefreshUrl = searchMeta["refresh_url"] != null ? (String) searchMeta["refresh_url"] : string.Empty,
         Query = searchMeta["query"] != null ? (String) searchMeta["query"] : string.Empty
     };
     return searchEntity;
 }
 public async void LoadSearchResults()
 {
     IsLoading = true;
     var items = new List<PostEntity>();
     var searchEntity = new SearchEntity();
     searchEntity =
         await SearchManager.SearchStatusList(Query, MaxStatusId, null, null, false, true, userAccountEntity);
     items = searchEntity.PostList;
     foreach (PostEntity item in items)
     {
         PostCollection.Add(item);
     }
     if (items.Any())
     {
         HasMoreItems = true;
         MaxStatusId = items.Last().StatusID;
     }
     else
     {
         HasMoreItems = false;
     }
     IsLoading = false;
 }