Checking we're on the UI thread in WPF
Use the Dispatcher.CheckAccess() method. Note; it doesn't appear in intellisense.
e.g.
if(!Dispatcher.CheckAccess())
{
// Invoke.
}
else
{
// Normal code
}
e.g.
if(!Dispatcher.CheckAccess())
{
// Invoke.
}
else
{
// Normal code
}
Comments
Post a Comment