title: Update WPF GUi while Parallel.ForEach
body: <p>I Have a WPF multithread application, and each thread updates some variables of objects binding to the xaml gui.</p>
  
  <p>If I Use a normal thread or a threadpool it works fine. Each object is being updated at real time in the GUI when the object  variables is changed by the treads.</p>
  
  <p>I want to use <code>Parallel.ForEach</code> because it stops the execution util all threads are finished. This is important to me for block the interface (because the use should wait), and for can show a finished message. The bad thing is that with Parallel.Foreach is not being updated in real time, only when all threads are finished.</p>
  
  <p>This way works, but It only updates the Gui at the end.</p>
  
  <pre><code>Parallel.ForEach(Computers, new ParallelOptions { MaxDegreeOfParallelism = 1}, computer =&gt; { PingTemp(computer); });
  </code></pre>
  
  <p>This way works, but It doesn't wait to the end of the ThreadPool.</p>
  
  <pre><code>Task.Factory.StartNew(() =&gt; Parallel.ForEach&lt;Computer&gt;(Computers, new ParallelOptions { MaxDegreeOfParallelism = 1 }, computer =&gt; PingTemp(computer)));
  </code></pre>
  
  <p>What approach do you recommend when the GUI is updated in realtime and wait the execution of threadpool before continue.</p>