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.
Highlights of Code
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
- Parallel.ForEach - allows you to easily do the same thing to every list item
- Interlocked.Increment - allows you to add to a number, thread-safe
- Sample usage of Tuples - pack several variables into a single object
- ObservableCollection - allows you to continually add to a Grid ItemsSource in WPF
- Progress Bar - shows file status loading asynchronously
- 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