private void AddSearchFilterToHistory(string filter, IEnumerable <object> results) { if (string.IsNullOrWhiteSpace(filter)) { return; } filter = filter.Trim(); lock (_lock) { SearchHistoryElement searchHistoryElement = null; foreach (var searchHistory in _searchHistory.SearchHistoryElements) { if (string.Equals(searchHistory.Filter, filter)) { searchHistoryElement = searchHistory; break; } } if (searchHistoryElement == null) { searchHistoryElement = new SearchHistoryElement(); searchHistoryElement.Filter = filter; _searchHistory.SearchHistoryElements.Add(searchHistoryElement); } searchHistoryElement.Count++; if (!searchHistoryElement.EverFoundResults && results.Any()) { searchHistoryElement.EverFoundResults = true; } SaveSearchHistory(); } }
private void AddSearchFilterToHistory(string filter, IEnumerable<object> results) { if (string.IsNullOrWhiteSpace(filter)) { return; } filter = filter.Trim(); lock (_lock) { SearchHistoryElement searchHistoryElement = null; foreach (var searchHistory in _searchHistory.SearchHistoryElements) { if (string.Equals(searchHistory.Filter, filter)) { searchHistoryElement = searchHistory; break; } } if (searchHistoryElement == null) { searchHistoryElement = new SearchHistoryElement(); searchHistoryElement.Filter = filter; _searchHistory.SearchHistoryElements.Add(searchHistoryElement); } searchHistoryElement.Count++; if (!searchHistoryElement.EverFoundResults && results.Any()) { searchHistoryElement.EverFoundResults = true; } SaveSearchHistory(); } }