title: Update progress bar in another thread
body: <p>I've read so many articles and other questions about this topic but because i am very new to C# and working with threads in general the answers were sadly mostly to complicated for me and or not applicable for my problem.</p>
  
  <p>I have this progressbar which will be filled with very small steps mostly 0.03%. When including this normally it went from 0-100 in an instand at the very end of the operation altough i runs through every time and updates it in 0.03% steps every time. I believe updating the progress bar in another thread will do the trick, but i sadly have no understanding of this topic as of now altough reading into it.</p>
  
  <p>This is the code section where my progress bar will be updated:</p>
  
  <pre><code>public void CopyAll(DirectoryInfo source, DirectoryInfo target)
  {
      string source4count = source.ToString();
      if (checkSubdirCase == 0)
      {
          allfiles = System.IO.Directory.GetFiles(source4count, "*.*", System.IO.SearchOption.AllDirectories);
          allFilesNum = allfiles.Length;
          progressbarinterval = 0;                    
          progressbarinterval = 100 / allFilesNum;
          Progressbarvalue = 0;
      }
  
      if (Directory.Exists(target.FullName) == false)
      {
          Directory.CreateDirectory(target.FullName);
      }
  
      foreach (FileInfo fi in source.GetFiles())
      {
          //HERE IS THE UPDATING OF THE PROGRESSBAR
          fi.CopyTo(System.IO.Path.Combine(target.ToString(), fi.Name), true);
          Progressbarvalue = Progressbarvalue + progressbarinterval;                      
          ProgressBarCopy.Value = Progressbarvalue;
      }
      foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
      {
          DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
          checkSubdirCase = 1;
          CopyAll(diSourceSubDir, nextTargetSubDir);
      }
  }
  </code></pre>
  
  <p>I hope someeone can help me and explain in a simple way how to tackle this and how background workers actually work.
  Regards</p>