private void ButtonFindNext1_Click(object sender, RoutedEventArgs e) { textSearcher.Searcher.MatchCase = CheckBoxMatchCase1.IsChecked == true; textSearcher.Searcher.SearchUp = CheckBoxSearchUp1.IsChecked == true; textSearcher.Searcher.SearchedText = ComboboxQuickFind.Text; curSearchResult = textSearcher.GetNextSearchResult(); if (curSearchResult != null) { Schematix.Windows.Code.Code window = core.OpenNewWindow(curSearchResult.Code.Path) as Schematix.Windows.Code.Code; if (window != null) { if (window.textEditor.IsLoaded == false) { window.textEditor.Loaded += new RoutedEventHandler(delegate { window.textEditor.Select(curSearchResult.Segment.StartOffset, curSearchResult.Segment.Length); }); } else { window.textEditor.Select(curSearchResult.Segment.StartOffset, curSearchResult.Segment.Length); } textSearcher.Searcher.Text = window.textEditor.Text; textSearcher.Searcher.StartOffset += curSearchResult.Segment.Length; } } else { textSearcher.Searcher.StartOffset = 0; UpdateSearchType1(); } }
private void Find_Executed(object sender, ExecutedRoutedEventArgs e) { textSearcher.Searcher.SearchedText = SearchBox.Text; SearchResult curSearchResult = textSearcher.GetNextSearchResult(); if (curSearchResult != null) { Schematix.Windows.Code.Code window = core.OpenNewWindow(curSearchResult.Code.Path) as Schematix.Windows.Code.Code; if (window != null) { if (window.textEditor.IsLoaded == false) { window.textEditor.Loaded += new RoutedEventHandler(delegate { window.textEditor.Select(curSearchResult.Segment.StartOffset, curSearchResult.Segment.Length); window.IsActive = false; SearchBox.Focus(); }); } else { window.textEditor.Select(curSearchResult.Segment.StartOffset, curSearchResult.Segment.Length); window.IsActive = false; SearchBox.Focus(); } } } else { MessageBox.Show("Nothing was found, Try again"); textSearcher.Searcher.StartOffset = 0; textSearcher.Searcher.SearchedText = SearchBox.Text; if (RadioButtonCurrentFileSearch.IsChecked == true) { textSearcher.Reset(SearchType.CurrentDocument); } if (RadioButtonCurrentProjectSearch.IsChecked == true) { textSearcher.Reset(SearchType.CurrentProject); } if (RadioButtonEntireSolutionSearchSearch.IsChecked == true) { textSearcher.Reset(SearchType.EntireSolution); } } }