This example shows how to update a UI component from a background thread by using a SynchronizationContext
void Button_Click(object sender, EventArgs args)
{
SynchronizationContext context = SynchronizationContext.Current;
Task.Run(() =>
{
for(int i = 0; i < 10; i++) ...