One Background Worker Thread and Multiple Progress Bars
===

I want to add multiple progress bars to a WinForm in order to monitor three potentially long processes that are in a nested loop. I theorized that I should be able to use just one Background worker thread, is the following implementation acceptable:

Here is my Class where the work is being done:

    class Class1
        {
            public static void UpdatePB(BackgroundWorker worker)
            {
                for (int i = 1; i <= 10; i++)
                {
                    for (int ii = 1; ii <= 10; ii++)
                    {
                        for (int iii = 1; iii <= 10; iii++)
                        {
                            Thread.Sleep(10);
                            worker.ReportProgress(iii, "PB3");
                        }
                        Thread.Sleep(10);
                        worker.ReportProgress(ii, "PB2");
                    }
                    Thread.Sleep(10);
                    worker.ReportProgress(i, "PB1");
                }
            }

and here is the backgroundWorker ProgressChanged Event:


        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            // Change the value of the ProgressBar to the BackgroundWorker progress.
            switch (e.UserState.ToString())
            {
                case "PB1":
                    progressBar1.Value = e.ProgressPercentage;
                    this.label1.Text = e.ProgressPercentage.ToString();
                    break;
                case "PB2":
                    progressBar2.Value = e.ProgressPercentage;
                    this.label2.Text = e.ProgressPercentage.ToString();
                    break;
                case "PB3":
                    progressBar3.Value = e.ProgressPercentage;
                    this.label3.Text = e.ProgressPercentage.ToString();
                    break;
            }
            
            Application.DoEvents();
        }
