Ejemplo n.º 1
0
        public static void GlobalSetClass(Class kls, string codedName)
        {
            if (codedName == null)
                throw new ArgumentNullException ("codedName");
            if (kls == null)
                throw new ArgumentNullException ("kls");

            using (var nsname = new NSString (codedName))
                XamCore.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle ("setClass:forClassName:"), kls.Handle, nsname.Handle);
        }
Ejemplo n.º 2
0
        public static void GlobalSetClassName(string name, Class kls)
        {
            if (name == null)
                throw new ArgumentNullException ("name");
            if (kls == null)
                throw new ArgumentNullException ("kls");

            var nsname = new NSString (name);
            XamCore.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle ("setClassName:forClass:"), nsname.Handle, kls.Handle);
            nsname.Dispose ();
        }
Ejemplo n.º 3
0
        internal static Class GetClass(Type type, string parameterName)
        {
            if (type == null)
                throw new ArgumentNullException (parameterName);

            var klass = new Class (type);
            // most API do not accept null so we throw in managed code instead of crashing the app
            if (klass.Handle == IntPtr.Zero)
                throw new ArgumentException ("Not an type exposed to ObjC", parameterName);

            return klass;
        }
Ejemplo n.º 4
0
		public static Type Lookup (Class @class)
		{
			return Lookup (@class.Handle, true);
		}
Ejemplo n.º 5
0
 public static string GlobalGetClassName(Class kls)
 {
     if (kls == null)
         throw new ArgumentNullException ("kls");
     return NSString.FromHandle (XamCore.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (class_ptr, Selector.GetHandle ("classNameForClass:"), kls.Handle));
 }
Ejemplo n.º 6
0
 internal static extern void protocol_addProperty(IntPtr protocol, string name, Class.objc_attribute_prop [] attributes, int count, bool isRequired, bool isInstance);
Ejemplo n.º 7
0
		public static NSObject Alloc (Class kls) {
			var h = Messaging.IntPtr_objc_msgSend (kls.Handle, Selector.GetHandle (Selector.Alloc));
			return new NSObject (h, true);
		}
Ejemplo n.º 8
0
 public NSObject DecodeTopLevelObject(Type[] types, string key, out NSError error)
 {
     #if XAMCORE_2_0
     NSSet<Class> typeSet = null;
     #else
     NSSet typeSet = null;
     #endif
     if (types != null) {
         var classes = new Class [types.Length];
         for (int i = 0; i < types.Length; i++)
             classes [i] =  new Class (types [i]);
     #if XAMCORE_2_0
         typeSet = new NSSet<Class> (classes);
     #else
         typeSet = new NSSet (classes);
     #endif
     }
     return DecodeTopLevelObject (typeSet, key, out error);
 }
Ejemplo n.º 9
0
 public static bool SupportsSecureCoding(Class klass)
 {
     if (klass == null)
         throw new ArgumentNullException ("klass");
     return SupportsSecureCoding (klass.Handle);
 }