void UpdateSuggestions() { var evt = new SearchSuggestionsEventArgs() { Etag = suggestionsEtag }; onSuggest?.Invoke(this, evt); if (evt.Etag == suggestionsEtag) { return; } object categoryPlaceholderTag = evt; suggestions = evt.items .Union(evt.categoryVisibility.Where(c => c.Value).Select(c => new SuggestionItem() { Category = c.Key, Data = categoryPlaceholderTag })) .GroupBy(i => i.Category) .SelectMany(g => Enumerable.Repeat(new ViewListItem() { Text = g.Key, LinkText = evt.categoryLinks.TryGeyValue(g.Key), data = null, category = g.Key, }, 1) .Union(g.Where(i => i.Data != categoryPlaceholderTag).Select(i => new ViewListItem() { Text = i.DisplayString, LinkText = i.LinkText, data = i })) ) .ToList(); suggestionsEtag = evt.Etag; view.SetListAvailability(suggestions.Count != 0); viewSuggestionsListValid = false; UpdateViewSuggestionsList(); }
void UpdateSuggestions() { var evt = new SearchSuggestionsEventArgs() { Etag = suggestionsEtag }; onSuggest?.Invoke(this, evt); if (evt.Etag == suggestionsEtag) { return; } object categoryPlaceholderTag = evt; suggestions = evt.items .Union(evt.categoryVisibility.Where(c => c.Value).Select(c => new SuggestionItem() { Category = c.Key, Data = categoryPlaceholderTag })) .GroupBy(i => i.Category) .SelectMany(g => Enumerable.Repeat(new SuggestionsListItem() { text = g.Key, linkText = evt.categoryLinks.TryGeyValue(g.Key), data = null, category = g.Key }, 1) .Union(g.Where(i => i.Data != categoryPlaceholderTag).Select(i => new SuggestionsListItem() { text = i.DisplayString, linkText = i.LinkText, data = i })) ) .ToImmutableArray(); suggestionsListVersion++; suggestionsEtag = evt.Etag; changeNotification.Post(); }