private async void Window_Loaded(object sender, RoutedEventArgs e) { this.tokenSource = new CancellationTokenSource(); this.search.Token = this.tokenSource.Token; await Task.Run(() => this.SearchResults = this.search.GetSearchResults(WordFileLocator.FindWordFiles(this.path, this.recursive), this.expression, this.isRegex)); this.Close(); }
private void runSearch(string path, bool recursive, string expression, bool regex, int resultWidth) { SearchResult[] searchResults = default; using (Search.Search search = new Search.Search(resultWidth)) { search.Process += this.Search_Process; searchResults = search.GetSearchResults(WordFileLocator.FindWordFiles(path, recursive), expression, regex); } this.completeSearch(searchResults); }