void FindNextButtonClicked(object sender, EventArgs e) { try { WritebackOptions(); var location = new SearchLocation(SearchOptions.SearchTarget, SearchOptions.LookIn, SearchOptions.LookInFiletypes, SearchOptions.IncludeSubdirectories, SearchOptions.SearchTarget == SearchTarget.CurrentSelection ? SearchManager.GetActiveSelection(true) : null); var strategy = SearchStrategyFactory.Create(SearchOptions.FindPattern, !SearchOptions.MatchCase, SearchOptions.MatchWholeWord, SearchOptions.SearchMode); lastMatch = SearchManager.FindNext(strategy, location); SearchManager.SelectResult(lastMatch); Focus(); } catch (SearchPatternException ex) { MessageService.ShowError(ex.Message); } }
public override void Run() { if (SearchOptions.CurrentFindPattern.Length > 0) { var location = new SearchLocation(SearchOptions.SearchTarget, SearchOptions.LookIn, SearchOptions.LookInFiletypes, SearchOptions.IncludeSubdirectories, SearchOptions.SearchTarget == SearchTarget.CurrentSelection ? SearchManager.GetActiveSelection(true) : null); var strategy = SearchStrategyFactory.Create(SearchOptions.FindPattern, !SearchOptions.MatchCase, SearchOptions.MatchWholeWord, SearchOptions.SearchMode); var result = SearchManager.FindNext(strategy, location); SearchManager.SelectResult(result); } else { Find find = new Find(); find.Run(); } }