• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ObjCRuntime.Selector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DoesNotRecognizeSelector

 public virtual void DoesNotRecognizeSelector(Selector sel)
 {
     #if MONOMAC
     Messaging.void_objc_msgSendSuper_intptr (SuperHandle, Selector.DoesNotRecognizeSelectorHandle, sel.Handle);
     #else
     Messaging.void_objc_msgSendSuper_intptr (SuperHandle, Selector.GetHandle (Selector.DoesNotRecognizeSelector), sel.Handle);
     #endif
 }
开发者ID:spicypixel-forks,项目名称:cs-maccore,代码行数:8,代码来源:NSObject2.cs


示例17: RespondsToSelector

		public virtual bool RespondsToSelector (Selector sel) {
			if (sel == null)
				throw new ArgumentNullException ("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:scriptam,项目名称:monomac,代码行数:9,代码来源:NSObject.cs


示例18: DoesNotRecognizeSelector

		public virtual void DoesNotRecognizeSelector (Selector sel) {
			if (sel == null)
				throw new ArgumentNullException ("sel");
			Console.WriteLine ("CRITICAL WARNING: [{0} {1}] is not recognized", this.GetType (), sel.Name);

			Messaging.void_objc_msgSendSuper_intptr (SuperHandle, selDoesNotRecognizeSelector, sel.Handle);
		}
开发者ID:scriptam,项目名称:monomac,代码行数:7,代码来源:NSObject.cs


示例19: DoesNotRecognizeSelector

 public virtual void DoesNotRecognizeSelector(Selector sel)
 {
     Messaging.void_objc_msgSendSuper_intptr (SuperHandle, Selector.DoesNotRecognizeSelector, sel.Handle);
 }
开发者ID:officedrop,项目名称:maccore,代码行数:4,代码来源:NSObject2.cs


示例20: handleCommandSelectors

		// -------------------------------------------------------------------------------
		//	handleCommandSelectors
		//
		//	Handle all command selectors that we can handle here
		// -------------------------------------------------------------------------------		
		private bool handleCommandSelectors(NSControl control, NSTextView textView, Selector commandSelector)
		{
			
			bool result = false;
			
			if (textView.RespondsToSelector (commandSelector)){
				commandHandling = true;
				textView.PerformSelector (commandSelector,null,-1);
				//commandHandling = false;
				result = true;
			}
			
			return result;
			
		}
开发者ID:RafasTavares,项目名称:mac-samples,代码行数:20,代码来源:SearchFieldWindowController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Common.PokerMemoryCache类代码示例发布时间:2022-05-26
下一篇:
C# Foundation.NSUrl类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap