static void OnSearchAllFinished(SearchAllFinishedEventArgs e) { lastSearches.Insert(0, e); if (SearchAllFinished != null) { SearchAllFinished(null, e); } }
public static void ShowSearchResults(string pattern, List<SearchResult> results) { SearchAndReplace.SearchAllFinishedEventArgs e = new SearchAllFinishedEventArgs(pattern, results); OnSearchAllFinished(e); PadDescriptor searchResultPanel = WorkbenchSingleton.Workbench.GetPad(typeof(SearchResultPanel)); if (searchResultPanel != null) { searchResultPanel.BringPadToFront(); SearchResultPanel.Instance.ShowSearchResults(pattern, results); } else { MessageService.ShowError("SearchResultPanel can't be created."); } }
public static void ShowSearchResults(string pattern, List <SearchResult> results) { SearchAndReplace.SearchAllFinishedEventArgs e = new SearchAllFinishedEventArgs(pattern, results); OnSearchAllFinished(e); PadDescriptor searchResultPanel = WorkbenchSingleton.Workbench.GetPad(typeof(SearchResultPanel)); if (searchResultPanel != null) { searchResultPanel.BringPadToFront(); SearchResultPanel.Instance.ShowSearchResults(pattern, results); } else { MessageService.ShowError("SearchResultPanel can't be created."); } }
void UpdateLastSearches(object sender, SearchAllFinishedEventArgs e) { dropDownButton.DropDownItems.Clear(); foreach (SearchAllFinishedEventArgs args in SearchInFilesManager.LastSearches) { ToolStripItem newItem = new ToolStripMenuItem(); newItem.Text = StringParser.Parse("${res:MainWindow.Windows.SearchResultPanel.OccurrencesOf}", new string[,] {{ "Pattern", args.Pattern }}) + " (" + SearchRootNode.GetOccurencesString(args.Results.Count) + ")"; newItem.Tag = args; newItem.Click += new EventHandler(SwitchSearchResults); dropDownButton.DropDownItems.Add(newItem); } dropDownButton.DropDownItems.Add(new ToolStripSeparator()); ToolStripItem clearHistoryItem = new ToolStripMenuItem(); clearHistoryItem.Text = StringParser.Parse("${res:MainWindow.Windows.SearchResultPanel.ClearHistory}"); clearHistoryItem.Click += new EventHandler(ClearHistory); dropDownButton.DropDownItems.Add(clearHistoryItem); dropDownButton.Enabled = IsEnabled; }
void SwitchSearchResults(object sender, EventArgs e) { SearchAllFinishedEventArgs args = (SearchAllFinishedEventArgs)((ToolStripItem)sender).Tag; // "bubble" this saved search to the top of the list SearchInFilesManager.LastSearches.Remove(args); SearchInFilesManager.LastSearches.Insert(0, args); UpdateLastSearches(null, args); PadDescriptor searchResultPanel = WorkbenchSingleton.Workbench.GetPad(typeof(SearchResultPanel)); if (searchResultPanel != null) { searchResultPanel.BringPadToFront(); SearchResultPanel.Instance.ShowSearchResults(args.Pattern, args.Results); } else { MessageService.ShowError("SearchResultPanel can't be found."); } }
void UpdateLastSearches(object sender, SearchAllFinishedEventArgs e) { dropDownButton.DropDownItems.Clear(); foreach (SearchAllFinishedEventArgs args in SearchInFilesManager.LastSearches) { ToolStripItem newItem = new ToolStripMenuItem(); newItem.Text = StringParser.Parse("${res:MainWindow.Windows.SearchResultPanel.OccurrencesOf}", new string[, ] { { "Pattern", args.Pattern } }) + " (" + SearchRootNode.GetOccurencesString(args.Results.Count) + ")"; newItem.Tag = args; newItem.Click += new EventHandler(SwitchSearchResults); dropDownButton.DropDownItems.Add(newItem); } dropDownButton.DropDownItems.Add(new ToolStripSeparator()); ToolStripItem clearHistoryItem = new ToolStripMenuItem(); clearHistoryItem.Text = StringParser.Parse("${res:MainWindow.Windows.SearchResultPanel.ClearHistory}"); clearHistoryItem.Click += new EventHandler(ClearHistory); dropDownButton.DropDownItems.Add(clearHistoryItem); dropDownButton.Enabled = IsEnabled; }
static void OnSearchAllFinished(SearchAllFinishedEventArgs e) { lastSearches.Insert(0, e); if (SearchAllFinished != null) { SearchAllFinished(null, e); } }