My UI getting updated when all task done
<p>see my below code and tell me what is wrong there for which my UI is getting updated when all task finish but as per code it suppose to update label value when my routine is calling by task. what to change in my code.</p>

<p>say for example when DoSomething1 is getting called then label3 need to be updated and reflected before user.</p>

<pre><code>private void button1_Click(object sender, EventArgs e)
{
    TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
    var token = Task.Factory.CancellationToken;

    var tasks = new[]
    {
        Task.Factory.StartNew( DoSomething1,token,TaskCreationOptions.None, uiScheduler),
        Task.Factory.StartNew(DoSomething2,token,TaskCreationOptions.None, uiScheduler),
        Task.Factory.StartNew(DoSomething3,token,TaskCreationOptions.None, uiScheduler)
    };
    Task.WaitAll(tasks);
    //var things = Task.WhenAll(tasks);

    int x=0;
}

public void DoSomething1()
{
    //this.label3.BeginInvoke(new Action(() =&gt;
    //{
    //    this.label3.Text = "DoSomething1 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    //}));
    this.label3.Text = "DoSomething1 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    System.Threading.Thread.Sleep(1000);
}

public void DoSomething2()
{
    //this.label4.BeginInvoke(new Action(() =&gt;
    //{
    //    this.label4.Text = "DoSomething2 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    //}));
    this.label4.Text = "DoSomething2 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    System.Threading.Thread.Sleep(1000);
}

public void DoSomething3()
{
    //this.label5.BeginInvoke(new Action(() =&gt;
    //{
    //    this.label5.Text = "DoSomething3 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    //}));
    this.label5.Text = "DoSomething3 -- " + System.Threading.Thread.CurrentThread.ManagedThreadId;
    System.Threading.Thread.Sleep(1000);
}
</code></pre>