title: Using background worker with multiple classes in C#
body: <p>I am learning to program in C# and have most of the basics down already. I am having trouble using the background worker and using it with multiple classes. This is a backup program that I am writing I have the following classes.</p>
  
  <p>lacie.cs   ---> used to search for backup device
  main.cs    ---> Main entry
  size.cs    ---> Determines the size of the backup
  xml.cs     ---> Reads an xml config file of directories to be backed up.</p>
  
  <p>I will show what I have in the main.cs so far.</p>
  
  <p>[main.cs code]</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace QXBackup
  {
      class main
      {
          static void Main(string[] args)
          {
              lacie BackupDrive = new lacie();
              BackupDrive.findLacie();
  
              xml xmlFile = new xml();
              xmlFile.ProcessXML();
  
              size BackupSize = new size();
              BackupSize.GetSize(xmlFile.Path);
  
              int SizeofBackup = (int)(((BackupSize.BackupSize) / 1024f) / 1024f) / 1024;
              Console.WriteLine("Drive Letter: " + BackupDrive.Drive);
              Console.WriteLine("Volume Name: " + BackupDrive.VolumeLabel);
              Console.WriteLine("Free Space: " + Convert.ToString(BackupDrive.AvailableSize) + "G");
              Console.WriteLine("Size of Lacie: " + Convert.ToString(BackupDrive.TotalSize) + "G");
              Console.WriteLine("Backup Size: " + Convert.ToString(SizeofBackup + "G"));
              Console.WriteLine("Backing up " + BackupSize.FileCount + " files found in " + BackupSize.FolderCount + " folders.");
              Console.ReadKey(true);
          }
      }
  }
  </code></pre>
  
  <p>[end main.cs code]</p>
  
  <p>now the program works fine so far and displays what I have asked it to print on the screen. My problem is as follows. When it goes off to calculate the size of the backup job the program just sits there waiting for teh size.cs class to return the value. I want to be able to use the background worker to have the program load and update the size number as it is calculating the size and show that on the screen. This is a console program and I am not sure if I will be able to do that but it will also help me as I plan to in the future turn this into a GUI based program. Can some one help me with this I have been trying all kinds of things and nothing works. I think my confusion is were to introduce the background worker and how to implement it correctly. Thanks for the help</p>