title: How to call a long method in a new thread to keep the UI running in C#
body: <p>I have WPF application with a combobox filled with Users, a grid showing some data for the selected User and a button that calls DoTimeSheetReport().</p>
  
  <p>DoTimeSheetReport() does some work and then opens a new window with a SSRS report. Everything works fine but the method takes a long time to complete, mostly because of the report, which means my UI becomes unresponsive. I tried a couple of ways to start a new thread/task but all of them are blocking the UI's thread. I'm probably doing something wrong but I have no idea.</p>
  
  <p>What's the best way to call a long method in order to not block the UI?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I changed my code to isolate the time-consuming part.</p>
  
  <pre><code>reportViewer.SetPageSettings(reportConfiguration.PageSettings);
  </code></pre>
  
  <p>Using a backgroundWorker on this part did it. Thank you for your help.</p>
  
  <p>@LuisQuijada: That worked, post an answer so I can accept it. </p>