internal void RemoveRecentIndex(string indexFile) { if (string.IsNullOrEmpty(indexFile)) { return; } var indexToRemove = RecentIndices.FirstOrDefault(cur => cur.IndexFile == indexFile); if (indexToRemove != null) { _RecentIndicesInternal.Remove(indexToRemove); Save(); } }
private void UpdateRecentIndices() { if (ApplicationService.ApplicationView.CurrentIndexFile == null) { return; } var openSearchTabs = ApplicationService.ApplicationView.Searches; if (openSearchTabs.Count == 0) { return; } var currentRecentIndexSetting = RecentIndices.FirstOrDefault(cur => cur.IndexFile == ApplicationService.ApplicationView.CurrentIndexFile.IndexFile); if (currentRecentIndexSetting == null) { return; } List <SearchTabSettings> tabSettings = new List <SearchTabSettings>(); foreach (var tab in openSearchTabs) { if (string.IsNullOrEmpty(tab.LastSearchText)) { continue; } tabSettings.Add(new SearchTabSettings { SearchText = tab.LastSearchText, MatchCase = tab.MatchCase, EnableWildcards = tab.EnableWildcards, MatchWholeWord = tab.MatchWholeWord, FileFilters = (tab.ActiveFileFilters.Any() ? tab.ActiveFileFilters.ToList() : null) }); } currentRecentIndexSetting.SearchTabs = tabSettings; }
public void AddRecentIndex(string name, string indexFile) { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(indexFile)) { return; } var matchingRecentIndex = RecentIndices.FirstOrDefault(cur => cur.IndexFile == indexFile); if (matchingRecentIndex != null) { _RecentIndicesInternal.Remove(matchingRecentIndex); _RecentIndicesInternal.Insert(0, matchingRecentIndex); } else { _RecentIndicesInternal.Insert(0, new RecentIndexSetting { Name = name, IndexFile = indexFile }); } SaveInternal(); }