/// <summary> /// Performs a search using the given string as query, but does not update /// the SearchResults object. /// </summary> /// <returns> Returns a list with a maximum MaxNumSearchResults elements.</returns> /// <param name="query"> The search query </param> internal IEnumerable <PackageManagerSearchElementViewModel> Search(string query) { if (LastSync == null) { return(new List <PackageManagerSearchElementViewModel>()); } var canLogin = PackageManagerClientViewModel.AuthenticationManager.HasAuthProvider; List <PackageManagerSearchElementViewModel> list = null; if (!String.IsNullOrEmpty(query)) { list = SearchDictionary.Search(query) .Select(x => new PackageManagerSearchElementViewModel(x, canLogin)) .Take(MaxNumSearchResults).ToList(); } else { // with null query, don't show deprecated packages list = LastSync.Where(x => !x.IsDeprecated) .Select(x => new PackageManagerSearchElementViewModel(x, canLogin)).ToList(); Sort(list, this.SortingKey); } foreach (var x in list) { x.RequestShowFileDialog += OnRequestShowFileDialog; } return(list); }
/// <summary> /// Performs a search using the given string as query, but does not update /// the SearchResults object. /// </summary> /// <returns> Returns a list with a maximum MaxNumSearchResults elements.</returns> /// <param name="query"> The search query </param> internal IEnumerable <PackageManagerSearchElementViewModel> Search(string query) { if (LastSync == null) { return(new List <PackageManagerSearchElementViewModel>()); } var canLogin = PackageManagerClientViewModel.Model.HasAuthProvider; if (!String.IsNullOrEmpty(query)) { return (SearchDictionary.Search(query) .Select(x => new PackageManagerSearchElementViewModel(x, canLogin)) .Take(MaxNumSearchResults)); } // with null query, don't show deprecated packages var list = LastSync.Where(x => !x.IsDeprecated) .Select(x => new PackageManagerSearchElementViewModel(x, canLogin)).ToList(); Sort(list, this.SortingKey); return(list); }
/// <summary> /// Performs a search using the given string as query, but does not update /// the SearchResults object. /// </summary> /// <returns> Returns a list with a maximum MaxNumSearchResults elements.</returns> /// <param name="search"> The search query </param> internal List <PackageManagerSearchElement> Search(string query) { if (!String.IsNullOrEmpty(query)) { return(SearchDictionary.Search(query, MaxNumSearchResults)); } else { // with null query, don't show deprecated packages return(LastSync.Where(x => !x.IsDeprecated).ToList()); } }
/// <summary> /// Performs a search using the given string as query, but does not update /// the SearchResults object. /// </summary> /// <returns> Returns a list with a maximum MaxNumSearchResults elements.</returns> /// <param name="search"> The search query </param> internal IEnumerable <PackageManagerSearchElement> Search(string query) { if (!String.IsNullOrEmpty(query)) { return(SearchDictionary.Search(query, MaxNumSearchResults)); } else { // with null query, don't show deprecated packages List <PackageManagerSearchElement> list = LastSync.Where(x => !x.IsDeprecated).ToList(); Sort(list, this.SortingKey); return(list); } }
/// <summary> /// Performs a search using the given string as query, but does not update /// the SearchResults object. /// </summary> /// <returns> Returns a list with a maximum MaxNumSearchResults elements.</returns> /// <param name="query"> The search query </param> internal IEnumerable <PackageManagerSearchElementViewModel> Search(string query) { if (LastSync == null) { return(new List <PackageManagerSearchElementViewModel>()); } List <PackageManagerSearchElementViewModel> list = null; var isEnabledForInstall = !(Preferences as IDisablePackageLoadingPreferences).DisableCustomPackageLocations; if (!String.IsNullOrEmpty(query)) { list = Filter(SearchDictionary.Search(query) .Select(x => new PackageManagerSearchElementViewModel(x, PackageManagerClientViewModel.AuthenticationManager.HasAuthProvider, CanInstallPackage(x.Name), isEnabledForInstall)) .Take(MaxNumSearchResults)) .ToList(); } else { // with null query, don't show deprecated packages list = Filter(LastSync.Where(x => !x.IsDeprecated) .Select(x => new PackageManagerSearchElementViewModel(x, PackageManagerClientViewModel.AuthenticationManager.HasAuthProvider, CanInstallPackage(x.Name), isEnabledForInstall))) .ToList(); Sort(list, this.SortingKey); if (SortingDirection == PackageSortingDirection.Descending) { list.Reverse(); } } foreach (var x in list) { x.RequestShowFileDialog += OnRequestShowFileDialog; } return(list); }