-
-
Save chamons/aa048f9d9db7a5252504a98c12fc81ee 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
using System; | |
using AppKit; | |
using Foundation; | |
namespace SavePanelTest | |
{ | |
public static class NSSavePanelPatch | |
{ | |
[System.Runtime.InteropServices.DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")] | |
extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector); | |
public static NSSavePanel GetSavePanel () | |
{ | |
return ObjCRuntime.Runtime.GetNSObject<NSSavePanel> (IntPtr_objc_msgSend (ObjCRuntime.Class.GetHandle ("NSSavePanel"), ObjCRuntime.Selector.GetHandle ("savePanel"))); | |
} | |
} | |
[Register ("AppDelegate")] | |
public class AppDelegate : NSApplicationDelegate | |
{ | |
public override void DidFinishLaunching (NSNotification notification) | |
{ | |
var panel = NSSavePanelPatch.GetSavePanel (); | |
panel.RunModal (); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for that very helpful. I'm getting an invalid cast though
I changed my code to
and get error...