示例#1
0
        private void OnTextChanged()
        {
            Suggestions.Clear();
            var text = Text.Trim();

            Suggestions.AddRange(
                allCountries
                .Where(c => c.Name.ContainsIgnoringCase(text))
                .Select(c => new SelectableCountryViewModel(c, c.Id == selectedCountryId))
                );
        }
        private void onSuggestions(IEnumerable <AutocompleteSuggestion> suggestions)
        {
            var firstSuggestion = suggestions.FirstOrDefault();

            IsSuggestingTags     = firstSuggestion is TagSuggestion;
            IsSuggestingProjects = firstSuggestion is ProjectSuggestion;

            Suggestions.Clear();

            var groupedSuggestions = groupSuggestions(suggestions).ToList();

            UseGrouping = groupedSuggestions.Count > 1;
            Suggestions.AddRange(groupedSuggestions);
        }
示例#3
0
        public override async Task Initialize()
        {
            await base.Initialize();

            allCountries = await new GetAllCountriesInteractor().Execute();

            var selectedElement = allCountries.Find(c => c.Id == selectedCountryId);

            if (selectedElement != null)
            {
                allCountries.Remove(selectedElement);
                allCountries.Insert(0, selectedElement);
            }

            Suggestions.AddRange(
                allCountries.Select(country => new SelectableCountryViewModel(
                                        country,
                                        country.Id == selectedCountryId)));
        }
示例#4
0
        private void onSuggestions(IEnumerable <AutocompleteSuggestion> suggestions)
        {
            var firstQuerySymbolIndex = TextFieldInfo.Text.IndexOfAny(new char[] { QuerySymbols.Tags, QuerySymbols.Projects });

            if (firstQuerySymbolIndex >= 0)
            {
                var firstQuerySymbol = TextFieldInfo.Text[firstQuerySymbolIndex];
                IsSuggestingTags     = firstQuerySymbol == QuerySymbols.Tags;
                IsSuggestingProjects = !TextFieldInfo.ProjectId.HasValue && firstQuerySymbol == QuerySymbols.Projects;
            }
            else
            {
                IsSuggestingTags = IsSuggestingProjects = false;
            }

            Suggestions.Clear();

            var groupedSuggestions = groupSuggestions(suggestions).ToList();

            UseGrouping = groupedSuggestions.Count > 1;
            Suggestions.AddRange(groupedSuggestions);
        }
 private void ShowSuggestions(IList <SearchSuggestion> suggestions)
 {
     Suggestions.Clear();
     Suggestions.AddRange(suggestions);
 }
示例#6
0
        private async Task LoadSuggestions()
        {
            var result = await _suggestionService.GetSuggestions();

            Suggestions.AddRange(result);
        }