// A click handler for the search button
        private void SearchMapsButtonClick(object sender, EventArgs e)
        {
            try
            {
                // Get information for the new portal item
                var search = _mapSearchTextbox.Text;

                // Create a new OnSaveMapEventArgs object to store the information entered by the user
                var mapSearchArgs = new OnSearchMapEventArgs(search);

                // Raise the OnSaveClicked event so the main activity can handle the event and save the map
                OnSearchClicked(this, mapSearchArgs);

                // Close the dialog
                this.Dismiss();
            }
            catch (Exception ex)
            {
                // Show the exception message (dialog will stay open so user can try again)
                var alertBuilder = new AlertDialog.Builder(this.Activity);
                alertBuilder.SetTitle("Error");
                alertBuilder.SetMessage(ex.Message);
                alertBuilder.Show();
            }
        }
        private async void OnSearchMapsClicked(object sender, OnSearchMapEventArgs e)
        {
            // Get web map portal items from a keyword search
            IEnumerable <PortalItem> mapItems = null;
            ArcGISPortal             portal;

            // Connect to the portal (anonymously)
            portal = await ArcGISPortal.CreateAsync(new Uri(ServerUrl));

            // Create a query expression that will get public items of type 'web map' with the keyword(s) in the items tags
            var queryExpression = string.Format("tags:\"{0}\" access:public type: (\"web map\" NOT \"web mapping application\")", e.SearchText);

            // Create a query parameters object with the expression and a limit of 10 results
            PortalQueryParameters queryParams = new PortalQueryParameters(queryExpression, 10);

            // Search the portal using the query parameters and await the results
            PortalQueryResultSet <PortalItem> findResult = await portal.FindItemsAsync(queryParams);

            // Get the items from the query results
            mapItems = findResult.Results;

            // Show the map results
            ShowMapList(mapItems);
        }