当前位置: 首页>>代码示例>>C#>>正文


C# ObjCRuntime.Selector类代码示例

本文整理汇总了C#中MonoMac.ObjCRuntime.Selector的典型用法代码示例。如果您正苦于以下问题:C# Selector类的具体用法?C# Selector怎么用?C# Selector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Selector类属于MonoMac.ObjCRuntime命名空间,在下文中一共展示了Selector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NativeConstructorBuilder

        internal NativeConstructorBuilder(ConstructorInfo cinfo)
        {
            ExportAttribute ea = (ExportAttribute) Attribute.GetCustomAttribute (cinfo, typeof (ExportAttribute));
            ParameterInfo [] parms = cinfo.GetParameters ();

            if (ea == null && parms.Length > 0)
                throw new ArgumentException ("ConstructorInfo does not have a export attribute");

            if (ea == null)
                Selector = selInit;
            else
                Selector = new Selector (ea.Selector, true).Handle;

            Signature = "@@:";
            ParameterTypes = new Type [2 + parms.Length];

            ParameterTypes [0] = typeof (IntPtr);
            ParameterTypes [1] = typeof (Selector);

            for (int i = 0; i < parms.Length; i++) {
                ParameterTypes [i + 2] = parms [i].ParameterType;
                Signature += TypeConverter.ToNative (parms [i].ParameterType);
            }

            DelegateType = CreateDelegateType (typeof (IntPtr), ParameterTypes);

            this.cinfo = cinfo;
        }
开发者ID:sichy,项目名称:monomac,代码行数:28,代码来源:NativeConstructorBuilder.cs

示例2: NativeMethodBuilder

        internal NativeMethodBuilder(MethodInfo minfo)
        {
            ExportAttribute ea = (ExportAttribute) Attribute.GetCustomAttribute (minfo.GetBaseDefinition (), typeof (ExportAttribute));

            if (ea == null)
                throw new ArgumentException ("MethodInfo does not have a export attribute");

            parms = minfo.GetParameters ();

            rettype = ConvertReturnType (minfo.ReturnType);
            // FIXME: We should detect if this is in a bound assembly or not and only alloc if needed
            Selector = new Selector (ea.Selector ?? minfo.Name, true).Handle;
            Signature = string.Format ("{0}@:", TypeConverter.ToNative (rettype));
            ParameterTypes = new Type [2 + parms.Length];

            ParameterTypes [0] = typeof (NSObject);
            ParameterTypes [1] = typeof (Selector);

            for (int i = 0; i < parms.Length; i++) {
                if (parms [i].ParameterType.IsByRef && (parms[i].ParameterType.GetElementType ().IsSubclassOf (typeof (NSObject)) || parms[i].ParameterType.GetElementType () == typeof (NSObject)))
                    ParameterTypes [i + 2] = typeof (IntPtr).MakeByRefType ();
                else
                    ParameterTypes [i + 2] = parms [i].ParameterType;
                // The TypeConverter will emit a ^@ for a byref type that is a NSObject or NSObject subclass in this case
                // If we passed the ParameterTypes [i+2] as would be more logical we would emit a ^^v for that case, which
                // while currently acceptible isn't representative of what obj-c wants.
                Signature += TypeConverter.ToNative (parms [i].ParameterType);
            }

            DelegateType = CreateDelegateType (rettype, ParameterTypes);

            this.minfo = minfo;
        }
开发者ID:sichy,项目名称:monomac,代码行数:33,代码来源:NativeMethodBuilder.cs

示例3: NativeMethodBuilder

		internal NativeMethodBuilder (MethodInfo minfo) {
			ExportAttribute ea = (ExportAttribute) Attribute.GetCustomAttribute (minfo.GetBaseDefinition (), typeof (ExportAttribute));
			ParameterInfo [] parms = minfo.GetParameters ();

			if (ea == null)
				throw new ArgumentException ("MethodInfo does not have a export attribute");

			rettype = ConvertReturnType (minfo.ReturnType);
			// FIXME: We should detect if this is in a bound assembly or not and only alloc if needed
			Selector = new Selector (ea.Selector ?? minfo.Name, true).Handle;
			Signature = string.Format ("{0}@:", TypeConverter.ToNative (rettype));
			ParameterTypes = new Type [2 + parms.Length];

			ParameterTypes [0] = typeof (NSObject);
			ParameterTypes [1] = typeof (Selector);

			for (int i = 0; i < parms.Length; i++) {
				if (parms [i].ParameterType.IsByRef && (parms[i].ParameterType.IsSubclassOf (typeof (NSObject)) || parms[i].ParameterType == typeof (NSObject)))
					ParameterTypes [i + 2] = typeof (IntPtr).MakeByRefType ();
				else
					ParameterTypes [i + 2] = parms [i].ParameterType;
				Signature += TypeConverter.ToNative (parms [i].ParameterType);
			}
			
			DelegateType = CreateDelegateType (rettype, ParameterTypes);

			this.minfo = minfo;
		}
开发者ID:kangaroo,项目名称:monomac,代码行数:28,代码来源:NativeMethodBuilder.cs

示例4: isSelectorExcludedFromWebScript

        static bool isSelectorExcludedFromWebScript(Selector sel)
        {
            switch (sel.Name)
            {
                case "clicked:":
                case "logMessage:":
                case "updateMarker:":
                    return false;
            }

            return true;
        }
开发者ID:kevintavog,项目名称:MapThis,代码行数:12,代码来源:WebViewDelegate.cs

示例5: webScriptNameForSelector

        static string webScriptNameForSelector(Selector sel)
        {
            switch (sel.Name)
            {
                case "clicked:":
                    return "clicked";

                case "logMessage:":
                    return "logMessage";

                case "updateMarker:":
                    return "updateMarker";
            }

            return "";
        }
开发者ID:kevintavog,项目名称:MapThis,代码行数:16,代码来源:WebViewDelegate.cs

示例6: NativeConstructorBuilder

		internal NativeConstructorBuilder (ConstructorInfo cinfo) {
			ExportAttribute ea = (ExportAttribute) Attribute.GetCustomAttribute (cinfo, typeof (ExportAttribute));

			Parameters = cinfo.GetParameters ();

			if (ea == null && Parameters.Length > 0)
				throw new ArgumentException ("ConstructorInfo does not have a export attribute");

			if (ea == null)
				Selector = selInit;
			else
				Selector = new Selector (ea.Selector, true).Handle;

			Signature = "@@:";
			ConvertParameters (Parameters, true, false);
			DelegateType = CreateDelegateType (typeof (IntPtr), ParameterTypes);

			this.cinfo = cinfo;
		}
开发者ID:LeszekW,项目名称:monomac,代码行数:19,代码来源:NativeConstructorBuilder.cs

示例7: NativeMethodBuilder

		internal NativeMethodBuilder (MethodInfo minfo, Type type, ExportAttribute ea) {
			if (ea == null)
				throw new ArgumentException ("MethodInfo does not have a export attribute");

			if (minfo.DeclaringType.IsGenericType)
				throw new ArgumentException ("MethodInfo cannot be in a generic type");

			Parameters = minfo.GetParameters ();

			rettype = ConvertReturnType (minfo.ReturnType);

			// FIXME: We should detect if this is in a bound assembly or not and only alloc if needed
			Selector = new Selector (ea.Selector ?? minfo.Name, true).Handle;
			Signature = string.Format ("{0}@:", TypeConverter.ToNative (rettype));

			ConvertParameters (Parameters, minfo.IsStatic, isstret);
			
			DelegateType = CreateDelegateType (rettype, ParameterTypes);

			this.minfo = minfo;
			this.type = type;
		}
开发者ID:jshakespear,项目名称:monomac,代码行数:22,代码来源:NativeMethodBuilder.cs

示例8: KeywordsCommandSelector

 private bool KeywordsCommandSelector(NSControl control, NSTextView textView, Selector commandSelector)
 {
     if (textView.RespondsToSelector(commandSelector))
     {
         commandHandling = true;
         textView.PerformSelector(commandSelector, null, -1);
         return true;
     }
     return false;
 }
开发者ID:kevintavog,项目名称:MapThis,代码行数:10,代码来源:TableDelegate.cs

示例9: AddObserver

 public void AddObserver(NSObject observer, Selector aSelector, string aname, NSObject anObject)
 {
     AddObserver (observer, aSelector, new NSString (aname), anObject);
 }
开发者ID:officedrop,项目名称:maccore,代码行数:4,代码来源:NSNotificationCenter.cs

示例10: RespondsToSelector

		public virtual bool RespondsToSelector (Selector sel) {
			if (IsDirectBinding) {
				return Messaging.bool_objc_msgSend_intptr (Handle, selRespondsToSelector, sel.Handle);
			} else {
				return Messaging.bool_objc_msgSendSuper_intptr (SuperHandle, selRespondsToSelector, sel.Handle);
			}
		}
开发者ID:roblillack,项目名称:monomac,代码行数:7,代码来源:NSObject.cs

示例11: BeginInvokeOnMainThread

		public void BeginInvokeOnMainThread (Selector sel, NSObject obj)
		{
			InvokeOnMainThread (sel, obj, false);
		}
开发者ID:roblillack,项目名称:monomac,代码行数:4,代码来源:NSObject.cs

示例12: PerformSelector

		public virtual void PerformSelector (Selector sel, NSObject obj, float delay) {
			if (IsDirectBinding) {
				Messaging.void_objc_msgSend_intptr_intptr_float (this.Handle, selPerformSelectorWithObjectAfterDelay, sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
			} else {
				Messaging.void_objc_msgSendSuper_intptr_intptr_float (this.SuperHandle, selPerformSelectorWithObjectAfterDelay, sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
			}
		}
开发者ID:roblillack,项目名称:monomac,代码行数:7,代码来源:NSObject.cs

示例13: InvokeOnMainThread

 private void InvokeOnMainThread(Selector sel, NSObject obj, bool wait)
 {
     #if MONOMAC
     Messaging.void_objc_msgSend_intptr_intptr_bool (this.Handle, Selector.PerformSelectorOnMainThreadWithObjectWaitUntilDoneHandle, sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, wait);
     #else
     Messaging.void_objc_msgSend_intptr_intptr_bool (this.Handle, Selector.GetHandle (Selector.PerformSelectorOnMainThreadWithObjectWaitUntilDone), sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, wait);
     #endif
 }
开发者ID:spicypixel-forks,项目名称:cs-maccore,代码行数:8,代码来源:NSObject2.cs

示例14: RespondsToSelector

 public virtual bool RespondsToSelector(Selector sel)
 {
     #if MONOMAC
     if (IsDirectBinding) {
         return Messaging.bool_objc_msgSend_intptr (this.Handle, selRespondsToSelectorHandle, sel.Handle);
     } else {
         return Messaging.bool_objc_msgSendSuper_intptr (this.SuperHandle, selRespondsToSelectorHandle, sel.Handle);
     }
     #else
     if (IsDirectBinding) {
         return Messaging.bool_objc_msgSend_intptr (this.Handle, Selector.GetHandle (selRespondsToSelector), sel.Handle);
     } else {
         return Messaging.bool_objc_msgSendSuper_intptr (this.SuperHandle, Selector.GetHandle (selRespondsToSelector), sel.Handle);
     }
     #endif
 }
开发者ID:spicypixel-forks,项目名称:cs-maccore,代码行数:16,代码来源:NSObject2.cs

示例15: PerformSelector

 public virtual void PerformSelector(Selector sel, NSObject obj, double delay)
 {
     if (sel == null)
         throw new ArgumentNullException ("sel");
     #if MONOMAC
     if (IsDirectBinding) {
         Messaging.void_objc_msgSend_intptr_intptr_double (this.Handle, Selector.PerformSelectorWithObjectAfterDelayHandle, sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
     } else {
         Messaging.void_objc_msgSendSuper_intptr_intptr_double (this.SuperHandle, Selector.PerformSelectorWithObjectAfterDelayHandle, sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
     }
     #else
     if (IsDirectBinding) {
         Messaging.void_objc_msgSend_intptr_intptr_double (this.Handle, Selector.GetHandle (Selector.PerformSelectorWithObjectAfterDelay), sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
     } else {
         Messaging.void_objc_msgSendSuper_intptr_intptr_double (this.SuperHandle, Selector.GetHandle (Selector.PerformSelectorWithObjectAfterDelay), sel.Handle, obj == null ? IntPtr.Zero : obj.Handle, delay);
     }
     #endif
 }
开发者ID:spicypixel-forks,项目名称:cs-maccore,代码行数:18,代码来源:NSObject2.cs


注:本文中的MonoMac.ObjCRuntime.Selector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。