-
-
Save chamons/c1abb5476f44a2ea26fadefcbf486ec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomNSApplication : NSApplication | |
{ | |
public CustomNSApplication (IntPtr handle) : base (handle) { } | |
public override void SendEvent (NSEvent theEvent) | |
{ | |
base.SendEvent (theEvent); | |
System.Console.WriteLine ("SendEvent"); | |
} | |
} | |
static class MainClass | |
{ | |
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")] | |
public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector); | |
static void Main (string[] args) | |
{ | |
NSApplication.Init (); | |
var appClassHandle = Class.GetHandle (typeof (CustomNSApplication)); | |
var selector = new Selector ("sharedApplication"); | |
var nsappHandle = IntPtr_objc_msgSend (appClassHandle, selector.Handle); | |
var customNSApplication = new CustomNSApplication (nsappHandle); | |
NSApplication.Main (args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment