mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
30 lines
559 B
C#
30 lines
559 B
C#
using CPF.Mac.Foundation;
|
|
using System.Threading;
|
|
|
|
namespace CPF.Mac.AppKit
|
|
{
|
|
internal class AppKitSynchronizationContext : SynchronizationContext
|
|
{
|
|
public override SynchronizationContext CreateCopy()
|
|
{
|
|
return new AppKitSynchronizationContext();
|
|
}
|
|
|
|
public override void Post(SendOrPostCallback d, object state)
|
|
{
|
|
NSRunLoop.Main.BeginInvokeOnMainThread(delegate
|
|
{
|
|
d(state);
|
|
});
|
|
}
|
|
|
|
public override void Send(SendOrPostCallback d, object state)
|
|
{
|
|
NSRunLoop.Main.InvokeOnMainThread(delegate
|
|
{
|
|
d(state);
|
|
});
|
|
}
|
|
}
|
|
}
|