Monday, November 13, 2017

Parallel Searcher make your own Windows Grep app

Here's a non-block UI thread c# WPF full Visual Studio solution that works and demonstrates the use of a background worker effectively, Parallel Searcher. 

This project is a great demonstration of the use of the BackgroundWorker class allows you to run an operation on a separate, dedicated thread. Time-consuming operations like downloads and database transactions can cause your user interface (UI) to seem as though it has stopped responding while they are running. When you want a responsive UI and you are faced with long delays associated with such operations, the BackgroundWorker class provides a convenient solution.

Parallel Searcher is like grep for windows and is a fun project to play with and easy to modify. The author Randy makes this code available license free.

Searched over 5,000 files in a couple of seconds!

Highlights of Code

  1. Parallel.ForEach - allows you to easily do the same thing to every list item
  2. Interlocked.Increment - allows you to add to a number, thread-safe
  3. Sample usage of Tuples - pack several variables into a single object
  4. ObservableCollection - allows you to continually add to a Grid ItemsSource in WPF
  5. Progress Bar - shows file status loading asynchronously
  6. Background worker - waiting for long task to finish and not block the GUI


More at Randy's site - https://actualrandy.wordpress.com/tag/observablecollection/



No comments:

Post a Comment