*Note:Rephrasing my question based on user's comments.
Need help on how to use .Net's Backgroundworker thread for the following purpose to increase UI responsiveness and performance in my .Net winforms application. When user clicks "Calculate" button in UI form,I'm doing this:
1.Get a list of categories C from database[this is typically around 10]
2.For each category C, do the following:
a.Call a third-party library, do some processing and calculate category price.
b.Get a list of products[This is typically around 800].
c.For each product, calculate its price using its category price from above.
d.Update this price of each product back in the database using a stored proc.
3.Update the progress back[or report any error message] to a form in UI.
FYI,I want to use Backgroundworker for steps #c and #d above.
I tried using Backgroundworker in my method.I put calls to InitializeBackgroundworker() and RunWorkerAsync() in the outermost loop[ie. step 2].But looks like, Backgroundworker is getting invoked only for the first category.What am I missing here?
So my question is, where do I make a call to InitializeBackgroundworker() and RunWorkerAsync()? And how do I make sure these 2 methods get called for each category?
Thanks for reading.