title: Task.Run a method who raise events
body: <p>In a Windows Store application, written in WPF and C#, I need to launch an async method who gather informations from files.  But I want it to run in background while to UI is responsive to user interactions.  So, I did this :</p>
  
  <pre><code>Task x = Task.Run(async () =&gt; await Method());
  </code></pre>
  
  <p>The problem is, "Method" must raise change notifications to the UI.  As you can expect, it crashed because the method who raise the event is not in the UI thread.</p>
  
  <p>So, I did this :</p>
  
  <pre><code>TaskScheduler t = TaskScheduler.FromCurrentSynchronisationContext();
  Task x = Task.Run(() =&gt; {}).ContinueWith(async _ =&gt; await Method(), t);
  </code></pre>
  
  <p>My question is, as I must specify a synchronization context, and as there is no way to specify it in the Run method, is there a way to do something like this :</p>
  
  <pre><code>TaskScheduler t = TaskScheduler.FromCurrentSynchronisationContext();
  Task x = Task.ContinueWith(async _ =&gt; await Method(), t);
  </code></pre>
  
  <p>Or, if you have another suggestion to make it work, it is welcome.</p>
  
  <p>Thank you.</p>