I'm working on an application which has several time consuming tasks (namely copying lots of files over the network) that need to happen in a specific order. I want to do these tasks using BackgroundWorkers to keep the UI from freezing up.
For sequential tasks, is it OK to switch out the DoWork and RunWorkerCompleted event handlers or should I use separate BackgroundWorkers?
Ex:
BGWorker.DoWork += FirstTask_DoWork;
BGWorker.RunWorkerCompleted += FirstTask_RWC;
<RunWorkerAsync>
BGWorker.DoWork -= FirstTask_DoWork;
BGWorker.RunWorkerCompleted -= FirstTask_RWC;
BGWorker.DoWork += SecondTask_DoWork;
BGWorker.RunWorkerCompleted += SecondTask_RWC;
Or
BackgroundWorker FirstTaskWorker = new BackgroundWorker();
BackgroundWorker SecondTaskWorker = new BackgroundWorker();
...
Thanks!