title: How to unblock "primary" thread for UI in winforms (using Parallel.Foreach)?
body: <p>using c#, .Net Framework 4.5, VS 2012</p>
  
  <p>Try to use <code>Parallel.Foreach</code> </p>
  
  <p>As result has some UI and add method for button (method allow to rotate all pic in folder and save in another place)</p>
  
  <pre><code>private void ProcessFileParallel()
      {
          string[] files =
              Directory.GetFiles(@"C:\Users\Public\Pictures\Sample Pictures",
              "*.jpg", SearchOption.AllDirectories); //get source folder
          string dirNew = @"C:\modifiedImages"; //new folder
          Directory.CreateDirectory(dirNew); //create dir
          //usage of parallel and lambda
          Parallel.ForEach(files, currfiles =&gt;
          {
              string fileName = Path.GetFileName(currfiles); //get cur name of file
               //GC for Bitmap
               //create new object of Bitmap
               using (Bitmap bitmap = new Bitmap(currfiles))
              {
                  bitmap.RotateFlip(RotateFlipType.Rotate180FlipX); //rotating
                  bitmap.Save(Path.Combine(dirNew, fileName)); //save as
                   //anonym delegate - used for safety access to UI elements from secondary thread
                  this.Invoke((Action)delegate
                  {
                      //caption name change for form
                      this.Text = 
                          string.Format("Curr Thread {0}", 
                          Thread.CurrentThread.ManagedThreadId);
                  }
                  );
              }
          }
          );            
      }
  </code></pre>
  
  <p>it's work, but after end (when all pic rotated and saved in new place, and UI got at top something like <code>Curr Thread 11</code>) primary thread is locked - means UI not active - can't do anything. 
  Question - How can i unlock my UI elements? </p>