Browse Source

Fix PerspexSynchronizationContext

pull/508/head
Nikita Tsukanov 11 years ago
parent
commit
de871a7537
  1. 6
      src/Perspex.Base/Threading/PerspexSynchronizationContext.cs

6
src/Perspex.Base/Threading/PerspexSynchronizationContext.cs

@ -42,8 +42,10 @@ namespace Perspex.Threading
/// <inheritdoc/>
public override void Send(SendOrPostCallback d, object state)
{
// TODO: Add check for being on the main thread, we should invoke the method immediately in this case
Dispatcher.UIThread.InvokeTaskAsync(() => d(state)).Wait();
if (Dispatcher.UIThread.CheckAccess())
d(state);
else
Dispatcher.UIThread.InvokeTaskAsync(() => d(state)).Wait();
}
}
}
Loading…
Cancel
Save