Пример #1
0
        /// <summary>
        /// Retrieves the suggestions from locator and displays them in a tableview below the textbox.
        /// </summary>
        /// <returns>The suggestions from locator async.</returns>
        /// <param name="searchText">Search text.</param>
        /// <param name="startSearchBarFlag">If set to <c>true</c> start search bar flag.</param>
        private async Task GetSuggestionsFromLocatorAsync(string searchText, bool startSearchBarFlag)
        {
            this.startSearchBarFlag = startSearchBarFlag;
            var suggestions = await LocationViewModel.Instance.GetLocationSuggestionsAsync(searchText);

            if (suggestions == null || suggestions.Count == 0)
            {
                this.AutosuggestionsTableView.Hidden = true;
            }

            // Only show the floors tableview if the buildings in view have more than one floor
            if (suggestions.Count > 0)
            {
                // Show the tableview with autosuggestions and populate it
                this.AutosuggestionsTableView.Hidden = false;
                var tableSource = new AutosuggestionsTableSource(suggestions);
                tableSource.TableRowSelected        += this.TableSource_TableRowSelected;
                this.AutosuggestionsTableView.Source = tableSource;

                this.AutosuggestionsTableView.ReloadData();

                // Auto extend or shrink the tableview based on the content inside
                var frame = this.AutosuggestionsTableView.Frame;
                frame.Height = this.AutosuggestionsTableView.ContentSize.Height;
                this.AutosuggestionsTableView.Frame = frame;
            }
        }
        /// <summary>
        /// Retrieves the suggestions from locator and displays them in a tableview below the textbox.
        /// </summary>
        /// <returns>Async task</returns>
        private async Task GetSuggestionsFromLocatorAsync()
        {
            var suggestions = await LocationViewModel.Instance.GetLocationSuggestionsAsync(this.HomeLocationSearchBar.Text);

            if (suggestions == null || suggestions.Count == 0)
            {
                this.AutosuggestionsTableView.Hidden = true;
            }

            // Only show the floors tableview if the buildings in view have more than one floor
            if (suggestions.Count > 0)
            {
                // Show the tableview with autosuggestions and populate it
                this.AutosuggestionsTableView.Hidden = false;
                var tableSource = new AutosuggestionsTableSource(suggestions);
                tableSource.TableRowSelected        += this.TableSource_TableRowSelected;
                this.AutosuggestionsTableView.Source = tableSource;
                this.AutosuggestionsTableView.ReloadData();
            }
        }
Пример #3
0
        /// <summary>
        /// Retrieves the suggestions from locator and displays them in a tableview below the textbox.
        /// </summary>
        /// <returns>The suggestions from locator</returns>
        private async Task GetSuggestionsFromLocatorAsync()
        {
            var suggestions = await LocationViewModel.Instance.GetLocationSuggestionsAsync(this.LocationSearchBar.Text);

            if (suggestions == null || suggestions.Count == 0)
            {
                this.AutosuggestionsTableView.Hidden = true;
            }
            else if (suggestions.Count > 0)
            {
                // Show the tableview with autosuggestions and populate it
                this.AutosuggestionsTableView.Hidden = false;
                var tableSource = new AutosuggestionsTableSource(suggestions);
                tableSource.TableRowSelected        += this.AutosuggestionsTableSource_TableRowSelected;
                this.AutosuggestionsTableView.Source = tableSource;

                this.AutosuggestionsTableView.ReloadData();

                // Auto extend or shrink the tableview based on the content inside
                var frame = this.AutosuggestionsTableView.Frame;
                frame.Height = this.AutosuggestionsTableView.ContentSize.Height;
                this.AutosuggestionsTableView.Frame = frame;
            }
        }