The calling thread cannot access this object because a different thread owns it
<p>Ok, my current code is work in progress and probably I will try to do the same thing with the Async CTP. But I will still like to understand whats happening. </p>

<p>I have a function like below</p>

<pre><code>// In MainWindow.xaml.cs
Task.Factory.StartNew(() =&gt; helper.Send());

// In class HttpHelper
public void Send()
{
    // ...

    try
    {
        Status = Statuses.Uploading;
        // write to request stream

        Status = Statuses.Downloading;
        // write to response stream

        Status = Statuses.Idle; // the exception is thrown here
        // ...
    }
    catch (Exception e)
    {
        // ...
    }
}
</code></pre>

<p>Full Code for <code>HttpHelper</code> <strong><a href="http://pastebin.com/cMdXpFdx" rel="nofollow">@pastebin</a></strong>. <code>Send()</code> on line 76</p>

<p>I wonder why I get the exception? Maybe I did something wrong with the threading, but why is the exception raised only after I successfully set the <code>Status</code> property 2 times? </p>

<h1>UPDATE: The Cause ...</h1>

<p>I had an event handler, listening to the <code>StatusChanged</code> event, in 1 if clause, I forgot to use the UI thread to update the UI</p>

<pre><code>helper.StatusChanged += (s, evt) =&gt;
{
    _dispatcher.Invoke(new Action(() =&gt; txtStatus.Text = helper.Status.ToString())); // I used _dispatcher here correctly

    if (helper.Status == HttpHelper.Statuses.Idle || helper.Status == HttpHelper.Statuses.Error)
       progBar.IsIndeterminate = false; // but not here
};
</code></pre>
