コード例 #1
0
        private async Task ProcessSearch(string query)
        {
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (SfdcConfig.AppSearchMode != SearchMode.UseSearchPage)
            {
                return;
            }

            var suggestedMedia = await _searchContentDataService.FilterMediaLinkByQuery(_mediaLinks, query);

            Results = suggestedMedia.Select(m => new SearchItemViewModel(m, IsInternalModeEnable)).Where(si => si.IsVisible).ToList();
            NoResultsMessageVisible = Results.Any() == false;
            NoResultsText           = $"No results for query: {query}";
        }
コード例 #2
0
ファイル: SearchViewModel.cs プロジェクト: hunsakerjeff/mcdsa
        private async Task PopulateResults(SearchBoxSuggestionsRequestedEventArgs arg)
        {
            var suggestionCollection = arg.Request.SearchSuggestionCollection;

            var suggestedMedia = await _searchContentDataService.FilterMediaLinkByQuery(_mediaLinks, arg.QueryText);

            _firstSuggestionID = suggestedMedia.Select(m => m.ID).FirstOrDefault();
            foreach (var mediaLink in suggestedMedia)
            {
                var imageFile = TypeIconResolver.GetIconStreamReference(mediaLink.Type);
                suggestionCollection.AppendResultSuggestion(mediaLink.Name, mediaLink.Description ?? string.Empty, mediaLink.ID, imageFile, string.Empty);
            }

            if (!suggestedMedia.Any())
            {
                suggestionCollection.AppendQuerySuggestion("No results");
            }
        }