CPF/CPF.Mac/Mac/Foundation/NSActionDispatcher.cs
2023-11-21 23:05:03 +08:00

32 lines
631 B
C#

using CPF.Mac.ObjCRuntime;
using System;
namespace CPF.Mac.Foundation
{
[Register("__MonoMac_NSActionDispatcher")]
internal sealed class NSActionDispatcher : NSObject
{
public const string SelectorName = "xamarinApplySelector";
public static readonly Selector Selector = new Selector("xamarinApplySelector");
private readonly NSAction action;
public NSActionDispatcher(NSAction action)
{
if (action == null)
{
throw new ArgumentNullException("action");
}
this.action = action;
}
[Export("xamarinApplySelector")]
[Preserve(Conditional = true)]
public void Apply()
{
action();
}
}
}