本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: isSelectorExcludedFromWebScript
static bool isSelectorExcludedFromWebScript(Selector sel)
{
switch (sel.Name)
{
case "clicked:":
case "logMessage:":
case "updateMarker:":
return false;
}
return true;
}
示例5: webScriptNameForSelector
static string webScriptNameForSelector(Selector sel)
{
switch (sel.Name)
{
case "clicked:":
return "clicked";
case "logMessage:":
return "logMessage";
case "updateMarker:":
return "updateMarker";
}
return "";
}
示例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;
}
示例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;
}
示例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;
}
示例9: AddObserver
public void AddObserver(NSObject observer, Selector aSelector, string aname, NSObject anObject)
{
AddObserver (observer, aSelector, new NSString (aname), anObject);
}
示例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);
}
}
示例11: BeginInvokeOnMainThread
public void BeginInvokeOnMainThread (Selector sel, NSObject obj)
{
InvokeOnMainThread (sel, obj, false);
}
示例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);
}
}
示例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
}
示例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
}
示例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
}