Post view page

Post #14

WPF Dispatcher
2011-12-28 06:35:22

I am not sure why it is not exposed but if you want to check if you are on the same thread as the current form you need to use the dsipatcher check access.

void BillboxHolder_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
    if (this.LayoutRoot.Dispatcher.CheckAccess())
    {
       this.ProgressBox_Status.Visibility = Visibility.Visible;
       this.ProgressBox_Status.Value = e.ProgressPercentage;
       this.TextBlock_Status.Text = "Processing...";
    }
    else
    {
       this.LayoutRoot.Dispatcher.Invoke(new EventHandler(BillboxHolder_ProgressChanged), new object[] { sender, e });
    }
}

Test right content

first test

Test right content

second test

Test right content

third test

this is a test