mirror of
https://github.com/cyanfish/naps2.git
synced 2024-08-16 10:40:35 +03:00
Add back Mac invoke workaround
This commit is contained in:
parent
0a7349ced6
commit
f90374717a
@ -26,6 +26,18 @@ public class MacEtoPlatform : EtoPlatform
|
||||
return new Application(Platforms.macOS);
|
||||
}
|
||||
|
||||
public override void Invoke(Application application, Action action)
|
||||
{
|
||||
// TODO: Eto PR to always use InvokeOnMainThread, don't execute the action directly
|
||||
// even if we're already on the main thread.
|
||||
NSApplication.SharedApplication.InvokeOnMainThread(action);
|
||||
}
|
||||
|
||||
public override void AsyncInvoke(Application application, Action action)
|
||||
{
|
||||
NSApplication.SharedApplication.BeginInvokeOnMainThread(action);
|
||||
}
|
||||
|
||||
public override IListView<T> CreateListView<T>(ListViewBehavior<T> behavior) =>
|
||||
new MacListView<T>(behavior);
|
||||
|
||||
|
@ -13,18 +13,18 @@ public class EtoInvoker : IInvoker
|
||||
|
||||
public void Invoke(Action action)
|
||||
{
|
||||
_application.Invoke(action);
|
||||
EtoPlatform.Current.Invoke(_application, action);
|
||||
}
|
||||
|
||||
public void InvokeDispatch(Action action)
|
||||
{
|
||||
_application.AsyncInvoke(action);
|
||||
EtoPlatform.Current.AsyncInvoke(_application, action);
|
||||
}
|
||||
|
||||
public T InvokeGet<T>(Func<T> func)
|
||||
{
|
||||
T value = default!;
|
||||
_application.Invoke(() => value = func());
|
||||
EtoPlatform.Current.Invoke(_application, () => value = func());
|
||||
return value;
|
||||
}
|
||||
}
|
@ -37,6 +37,16 @@ public abstract class EtoPlatform
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Invoke(Application application, Action action)
|
||||
{
|
||||
application.Invoke(action);
|
||||
}
|
||||
|
||||
public virtual void AsyncInvoke(Application application, Action action)
|
||||
{
|
||||
application.AsyncInvoke(action);
|
||||
}
|
||||
|
||||
public virtual void SetContainerSize(Window window, Control container, Size size, int padding)
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user