Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Having difficulty converting old Monomac DllImports for new Unified API

GraGra33GraGra33 USMember
edited February 2015 in Xamarin.iOS

I've been converting old GIT code to the new Unified API and have hit the following that I cannot convert:

    [DllImport (MonoMac.Constants.AppKitLibrary, EntryPoint="NSDrawWindowBackground")]
    public extern static void DrawWindowBackground (CGRect aRect);

    [DllImport (MonoMac.Constants.AppKitLibrary, EntryPoint="NSSetFocusRingStyle")]
    public extern static void SetFocusRingStyle (NSFocusRingPlacement placement);

    [DllImport (MonoMac.Constants.AppKitLibrary, EntryPoint="NSDisableScreenUpdates")]
    public extern static void DisableScreenUpdates ();

    [DllImport (MonoMac.Constants.AppKitLibrary, EntryPoint="NSEnableScreenUpdates")]
    public extern static void EnableScreenUpdates ();

I keep getting "The name 'MonoMac' does not exist in the current context" compile-time message & when I strip 'MonoMac' I receive the same message "The name 'Constants' does not exist in the current context.

What am I missing here?

Thanks,

Graeme

Posts

  • ReinisLusisReinisLusis LVMember

    MonoMac.Constants.AppKitLibrary simply resolves to "/System/Library/Frameworks/AppKit.framework/AppKit"

  • GraGra33GraGra33 USMember

    MonoMac.Constants.AppKitLibrary simply resolves to "/System/Library/Frameworks/AppKit.framework/AppKit"

    Please forgive my ignorance, but I am new to Mac dev... what would be the fix then?

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Just hard code the string constant:

    [DllImport ("/System/Library/Frameworks/AppKit.framework/AppKit", EntryPoint="NSEnableScreenUpdates")]
    public extern static void EnableScreenUpdates ();
    

    Apple isn't moving AppKit anytime.

  • GraGra33GraGra33 USMember

    Thanks Chris... Now I just need to figure out why NSCellMask is not found in the "Unified" AppKit ... :neutral:

Sign In or Register to comment.