示例#1
0
        public IEnumerable GetSuggestions(string filter, object parameter)
        {
            IEnumerable <string> suggestions = this.GeoSuggester.SuggestAsync(filter).GetAwaiter().GetResult().Take(5);

            GeoObjectCollection objects = new GeoObjectCollection(suggestions.AsParallel().SelectMany(elem => this.Geocoder.GeocodeAsync(elem, 5).GetAwaiter().GetResult()));

            return(objects.Where(geo => geo.GeocoderMetaData.Kind == GeoObjectKind.Locality && !string.IsNullOrEmpty(geo.ToString())).Distinct().ToList().Distinct());
        }
        public IEnumerable GetSuggestions(string filter, object parameter)
        {
            GeoObject street = (GeoObject)parameter;

            IEnumerable <string> suggestions = this.GeoSuggester.SuggestAsync(this.BuildFilter(street, filter)).GetAwaiter().GetResult().Take(100);

            GeoObjectCollection objects = new GeoObjectCollection(suggestions.AsParallel().SelectMany(elem => this.Geocoder.GeocodeAsync(elem, 15).GetAwaiter().GetResult()));

            return(objects.Where(o => this.IsBuildingOnCity(o, street)).Distinct().ToList());
        }