I've been working on the same project now since Christmas. I've been asked to take it from a Console Application (which just prints out trace statements), to a full Windows App. Sure, that's fine. The only thing is there are parts of the App that can take several minutes to almost an hour to run. I need to multithread it to show the user status, or errors. But I have no idea where to begin.
I've aready built a little UI in WPF. It's very basic, but I'd like to expand it as I need to. The app works by selecting a source, choosing a destination, and clicking start. I would like a listbox to update as the process goes along. Much in the same way SQL Server Installs, each step has a green check mark by its name as it completes.
How does a newbie start multithreading? What libraries should I check out? Any advice would be greatly appreciated.
p.s. I'm currently reading about this library, http://www.codeplex.com/smartthreadpool
@Martin: Here is how my app is constructed:
- Engine: Runs all major components in pre-defined order
- Excel: Library I wrote to wrap COM to open/read/close/save Workbooks
- Library: Library which understands different types of workbook formats (5 total)
- Business Classes: Classes I've written to translate Excel data and prep it for Access
- Db Library: A Library I've written which uses ADO.NET to read in Access data
- AppSettings: you get the idea
- Serialier: Save data in-case of app crash
I use everything from LINQ to ADO.NET to get data, transform it, and then output it.
My main requirement is that I want to update my UI to indicate progress
@Frank: What happens if something in the Background Worker throws an Exception (handled or otherwise)? How does my application recieve notice?
@Eric Lippert: Yes, I'm investigating that right now. Before I complicate things.
Let me know if you need more info. Currently I've running this application from a Unit Test, so I guess callig it a Console Application isn't true. I use Resharper to do this. I'm the only person right now who uses the app, but I'd like a more attractive interface