private async Task<IEnumerable<object>> GetPortalItemsAsync(SearchParameters sp)
{
NoResults = false;
// since GetPortalItemsAsync is called subsequently by the incremental loading collection,
// always make sure the search text is valid.
if (!IsSearchQueryValid(SearchQuery))
{
NoResults = true;
_totalHits = 0;
return null;
}
var ps = PortalService.CurrentPortalService;
if (PortalService.CurrentPortalService == null)
return null;
IsLoadingData = true;
SearchResultInfo<ArcGISPortalItem> r = await ps.GetSearchResults(sp);
IsLoadingData = false;
// set NoResults each time to avoid false intermediate setting of
// this depedency property
if (r == null || r.TotalCount == 0 )
{
NoResults = true;
_totalHits = 0;
return null;
}
_totalHits = r.TotalCount;
return r.Results;
}