Skip to content

Instantly share code, notes, and snippets.

@abfo
Created September 30, 2018 00:59
Show Gist options
  • Save abfo/a8da3aac2c313b979c8fef00dc85beca to your computer and use it in GitHub Desktop.
Save abfo/a8da3aac2c313b979c8fef00dc85beca to your computer and use it in GitHub Desktop.
void someEvent_Handler(object sender, SomeEventEventArgs e)
{
if (this.Dispatcher.CheckAccess())
{
// do work on UI thread
}
else
{
// or BeginInvoke()
this.Dispatcher.Invoke(new Action(someEvent_Handler),
sender, e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment