Esempio n. 1
0
        private void InitializeList()
        {
            _operationInProgressLabel.Visibility = ViewStates.Gone;
            _listView = FindViewById <ListView>(Resource.Id.list_view);
            _adapter  = new ResultsListAdapter(this);

            _listView.Adapter    = _adapter;
            _listView.Visibility = ViewStates.Visible;
            _listView.ItemClick += OnItemClick;
        }
        public void OnReceivedSearchResults(IList <SKSearchResult> results)
        {
            BuildResultsMap(results);

            _operationInProgressLabel.Visibility = ViewStates.Gone;
            _listView.Visibility = ViewStates.Visible;

            _adapter = new ResultsListAdapter(this);

            _listView.Adapter = _adapter;

            _listView.ItemClick += (s, e) =>
            {
                if (_selectedMainCategory == null)
                {
                    _selectedMainCategory = SKCategories.SKPOIMainCategory.ForInt(MainCategories[e.Position]);
                    _adapter.NotifyDataSetChanged();
                }
            };
        }
        public void OnReceivedSearchResults(IList <SKSearchResult> results)
        {
            FindViewById(Resource.Id.label_operation_in_progress).Visibility = ViewStates.Gone;
            _listView.Visibility = ViewStates.Visible;

            foreach (SKSearchResult result in results)
            {
                string firstLine;
                if (String.IsNullOrEmpty(result.Name))
                {
                    firstLine = result.Category.Name();
                    firstLine = firstLine.Substring(firstLine.IndexOf("_") + 1);
                }
                else
                {
                    firstLine = result.Name;
                }

                _items.Add(new Tuple <string, string>(firstLine, result.Category.Value.ToString()));
            }

            _adapter          = new ResultsListAdapter(this);
            _listView.Adapter = _adapter;
        }