private void DoSearch()
{
ResultsListBox.ItemsSource = null;
ResetVisibility();
if (QueryText == null || string.IsNullOrEmpty(QueryText.Text.Trim())) return;
if (string.IsNullOrEmpty(portal.Url))
portal.Url = DEFAULT_SERVER_URL;
var queryString = string.Format("{0} type:\"web map\" NOT \"web mapping application\"", QueryText.Text.Trim());
if (portal.CurrentUser != null && portal.ArcGISPortalInfo != null && !string.IsNullOrEmpty(portal.ArcGISPortalInfo.Id))
queryString = string.Format("{0} and orgid: \"{1}\"", queryString, portal.ArcGISPortalInfo.Id);
var searchParameters = new SearchParameters()
{
QueryString = queryString,
SortField = "avgrating",
SortOrder = QuerySortOrder.Descending,
Limit = 20
};
portal.SearchItemsAsync(searchParameters, (result, error) =>
{
ResultsListBox.ItemsSource = result.Results;
});
}