Cocoa.Bundle.LoadFramework C# (CSharp) Method

LoadFramework() public static method

public static LoadFramework ( string frameworkname ) : void
frameworkname string
return void
        public static void LoadFramework(string frameworkname)
        {
            if (Directory.Exists (System.String.Format ("/System/Library/Frameworks/{0}.framework", frameworkname))) {
                Bundle b = Bundle.BundleWithPath (System.String.Format ("/System/Library/Frameworks/{0}.framework", frameworkname));
                if (b.NativeObject == IntPtr.Zero)
                    throw new Exception ("Error loading framework: {0}" + frameworkname);
                b.Load ();
                return;
            }
            if (Directory.Exists (System.String.Format ("./{0}.framework", frameworkname))) {
                Bundle b = Bundle.BundleWithPath (System.String.Format ("./{0}.framework", frameworkname));
                if (b.NativeObject == IntPtr.Zero)
                    throw new Exception ("Error loading framework: {0}" + frameworkname);
                b.Load ();
                return;
            }
            // TODO: Load from MainBundle.ResourcePath
            throw new Exception ("Couldn't locate framework: " + frameworkname);
        }

Usage Example

 public static void LoadFramework(string frameworkname)
 {
     Bundle.LoadFramework(frameworkname);
 }