public static void DecideUse(NSObject decisionToken) { if (decisionToken == null) throw new ArgumentNullException ("token"); XamCore.ObjCRuntime.Messaging.void_objc_msgSend (decisionToken.Handle, selUse); }
public static void RemoveDoubleAction(NSObject target, EventHandler doubleHandler) { ActionDispatcher ctarget = target as ActionDispatcher; if (ctarget == null) return; ctarget.DoubleActivated -= doubleHandler; }
public UISegmentedControl(object [] args) : base(NSObjectFlag.Empty) { if (args == null) throw new ArgumentNullException ("args"); NSObject [] nsargs = new NSObject [args.Length]; for (int i = 0; i < args.Length; i++){ object a = args [i]; if (a == null) throw new ArgumentNullException (String.Format ("Element {0} in args is null", i)); if (a is string) nsargs [i] = new NSString ((string) a); else if (a is UIImage) nsargs [i] = (UIImage) a; else throw new ArgumentException (String.Format ("non-string or UIImage at position {0} with type {1}", i, a.GetType ())); } using (NSArray nsa = NSArray.FromNSObjects (nsargs)){ Handle = InitWithItems (nsa.Handle); } }
IntPtr InitNSThread(NSObject target, Selector selector, NSObject argument) { if (target == null) throw new ArgumentNullException ("target"); if (selector == null) throw new ArgumentNullException ("selector"); return xamarin_init_nsthread (IsDirectBinding ? this.Handle : this.SuperHandle, IsDirectBinding, target.Handle, selector.Handle, argument == null ? IntPtr.Zero : argument.Handle); }
static CGRect RectangleFFrom(NSObject key, NSNotification n) { if (n == null || n.UserInfo == null) throw new ArgumentNullException ("n"); var val = n.UserInfo [key] as NSValue; if (val != null) return val.CGRectValue; return CGRect.Empty; }
internal static Class GetClass(NSObject instance, string parameterName) { if (instance == null) throw new ArgumentNullException (parameterName); var klass = instance.Class; if ((klass == null) || (klass.Handle == IntPtr.Zero)) throw new ArgumentException ("Not an type exposed to ObjC", parameterName); return klass; }
public NSObject AddObserver(NSString aName, Action<NSNotification> notify, NSObject fromObject) { if (notify == null) throw new ArgumentNullException ("notify"); var proxy = new InternalNSNotificationHandler (this, notify); AddObserver (proxy, new Selector (postSelector), aName, fromObject); return proxy; }
void RemoveObserversFromList(NSObject observer, string aName, NSObject anObject) { for (int i = __mt_ObserverList_var.Count - 1; i >= 0; i--) { ObservedData od = __mt_ObserverList_var [i]; if (observer != od.Observer) continue; if (aName != null && aName != od.Name) continue; if (anObject != null && anObject != od.Object) continue; __mt_ObserverList_var.RemoveAt (i); } }
public void PresentController(string [] names, string [] contexts) { NSObject[] array = null; try { if (contexts != null) { array = new NSObject [contexts.Length]; for (int i = 0; i < array.Length; i++) array [i] = new NSString (contexts [i]); } PresentController (names, array); } finally { if (array != null) { foreach (var ns in array) ns.Dispose (); } } }
public NSObject AddObserver(string aName, Action <NSNotification> notify, NSObject fromObject) { return(AddObserver(new NSString(aName), notify, fromObject)); }
public static NSLayoutConstraint Create (NSObject view1, NSLayoutAttribute attribute1, NSLayoutRelation relation) { return NSLayoutConstraint.Create (view1, attribute1, relation, null, NSLayoutAttribute.NoAttribute, 1.0f, 0f); }
public static void ReleaseNative(IntPtr handle) { NSObject.DangerousRelease(handle); }
// typedef uint32_t UIAccessibilityNotifications public static void PostNotification(UIAccessibilityPostNotification notification, NSObject argument) { PostNotification (NotificationEnumToInt (notification), argument); }
internal void SetValue(string key, NSObject value) { using (var nskey = new NSString (key)){ SetValueForKey (value, nskey); } }
public void AddObserver(NSObject observer, Selector aSelector, string aName, string anObject) { }
public static NSString LocalizedFormat (NSString format, params object [] args) { int argc = args.Length; var nso = new NSObject [argc]; for (int i = 0; i < argc; i++) nso [i] = NSObject.FromObject (args [i]); return LocalizedFormat (format, nso); }
public VTStatus SetProperty(NSString propertyKey, NSObject value) { if (propertyKey == null) throw new ArgumentNullException ("propertyKey"); return VTSessionSetProperty (handle, propertyKey.Handle, value != null ? value.Handle : IntPtr.Zero); }
public void SetArray(string key, NSObject [] value) { _SetArray (value, key); }
static extern void NSShowAnimationEffect(nuint animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo);
public static void ShowAnimationEffect(NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo) { NSShowAnimationEffect ((nuint)(ulong)animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo); }
public virtual void PerformSelector(Selector sel, NSObject obj, float delay) { PerformSelector(sel, obj, (double)delay); }
internal NSDictionary ToDictionary() { int n = 0; if (DirectionsMode.HasValue) n++; #if !WATCH if (MapType.HasValue) n++; #endif if (MapCenter.HasValue) n++; if (MapSpan.HasValue) n++; #if !WATCH if (ShowTraffic.HasValue) n++; if (Camera != null) n++; #endif if (n == 0) return null; var keys = new NSObject [n]; var values = new NSObject [n]; int i = 0; if (DirectionsMode.HasValue){ keys [i] = MKMapItem.MKLaunchOptionsDirectionsModeKey; NSString v = MKMapItem.MKLaunchOptionsDirectionsModeDriving; switch (DirectionsMode.Value){ case MKDirectionsMode.Driving: v = MKMapItem.MKLaunchOptionsDirectionsModeDriving; break; case MKDirectionsMode.Transit: v = MKMapItem.MKLaunchOptionsDirectionsModeTransit; break; case MKDirectionsMode.Walking: v = MKMapItem.MKLaunchOptionsDirectionsModeWalking; break; } values [i++] = v; } #if !WATCH // MapType: __WATCHOS_PROHIBITED if (MapType.HasValue){ keys [i] = MKMapItem.MKLaunchOptionsMapTypeKey; values [i++] = new NSNumber ((int) MapType.Value); } #endif if (MapCenter.HasValue){ keys [i] = MKMapItem.MKLaunchOptionsMapCenterKey; values [i++] = NSValue.FromMKCoordinate (MapCenter.Value); } if (MapSpan.HasValue){ keys [i] = MKMapItem.MKLaunchOptionsMapSpanKey; values [i++] = NSValue.FromMKCoordinateSpan (MapSpan.Value); } #if !WATCH // ShowsTraffic: __WATCHOS_PROHIBITED if (ShowTraffic.HasValue){ keys [i] = MKMapItem.MKLaunchOptionsShowsTrafficKey; values [i++] = new NSNumber (ShowTraffic.Value); } #endif #if !WATCH // MKLaunchOptionsCameraKey is allowed in WatchOS, but there's no MKMapCamera type. if (Camera != null) { keys [i] = MKMapItem.MKLaunchOptionsCameraKey; values [i++] = Camera; } #endif return NSDictionary.FromObjectsAndKeys (values, keys); }
// This solves the duplicate selector export problem while not breaking the API. public static NSLayoutConstraint Create(NSObject view1, NSLayoutAttribute attribute1, NSLayoutRelation relation, NSObject view2, NSLayoutAttribute attribute2, nfloat multiplier, nfloat constant) { return Create ((INativeObject) view1, attribute1, relation, view2, attribute2, multiplier, constant); }
internal NSDictionary ToDictionary() { int n = 0; var font = Font; if (font != null) n++; var text_color = TextColor; if (text_color != null) n++; var text_shadow_color = TextShadowColor; if (text_shadow_color != null) n++; var text_shadow_offset = TextShadowOffset; if (text_shadow_offset.Horizontal != 0 || text_shadow_offset.Vertical != 0) n++; if (n == 0) return new NSDictionary (); var keys = new NSObject [n]; var values = new NSObject [n]; n = 0; if (font != null){ keys [n] = UITextAttributesConstants.Font; values [n] = font; n++; } if (text_color != null){ keys [n] = UITextAttributesConstants.TextColor; values [n] = text_color; n++; } if (text_shadow_color != null){ keys [n] = UITextAttributesConstants.TextShadowColor; values [n] = text_shadow_color; n++; } if (text_shadow_offset.Horizontal != 0 || text_shadow_offset.Vertical != 0){ keys [n] = UITextAttributesConstants.TextShadowOffset; values [n] = NSValue.FromUIOffset (text_shadow_offset); } using (NSArray avalues = NSArray.FromObjects (values), akeys = NSArray.FromObjects (keys)){ return NSDictionary.FromObjectsAndKeysInternal (avalues, akeys); } }
public static NSString LocalizedFormat (NSString format, NSObject [] args) { switch (args.Length){ case 0: return new NSString (xamarin_localized_string_format (format.Handle)); case 1: return new NSString (xamarin_localized_string_format_1 (format.Handle, args[0].Handle)); case 2: return new NSString (xamarin_localized_string_format_2 (format.Handle, args[0].Handle, args[1].Handle)); case 3: return new NSString (xamarin_localized_string_format_3 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle)); case 4: return new NSString (xamarin_localized_string_format_4 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle)); case 5: return new NSString (xamarin_localized_string_format_5 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle, args[4].Handle)); case 6: return new NSString (xamarin_localized_string_format_6 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle, args[4].Handle, args[5].Handle)); case 7: return new NSString (xamarin_localized_string_format_7 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle, args[4].Handle, args[5].Handle, args[6].Handle)); case 8: return new NSString (xamarin_localized_string_format_8 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle, args[4].Handle, args[5].Handle, args[6].Handle, args[7].Handle)); case 9: return new NSString (xamarin_localized_string_format_9 (format.Handle, args[0].Handle, args[1].Handle, args[2].Handle, args[3].Handle, args[4].Handle, args[5].Handle, args[6].Handle, args[7].Handle, args[8].Handle)); default: throw new Exception ("Unsupported number of arguments, maximum number is 9"); } }
public SKKeyframeSequence(NSObject [] values, NSNumber [] times) : this(values, NSArray.FromNSObjects (times)) { }
public void RemoveObserver(NSObject observer, string aName, string anObject) { }
public void AddObserver(NSObject observer, Selector aSelector, string aname, NSObject anObject) { AddObserver(observer, aSelector, new NSString(aname), anObject); }
public void SetWebScriptValueAtIndex(int /* unsigned int */ index, NSObject value) { SetWebScriptValueAtIndexvalue (index, value); }
public bool SetValueMatchingImageProperty(NSString dictionaryName, NSString propertyName, NSObject value) { if (value == null) throw new ArgumentNullException ("value"); return SetValueMatchingImageProperty (dictionaryName, propertyName, value.Handle); }
public static void PostNotification(int notification, NSObject argument) { UIAccessibilityPostNotification (notification, argument == null ? IntPtr.Zero : argument.Handle); }
public static NSLayoutConstraint Create (NSObject view1, NSLayoutAttribute attribute1, NSLayoutRelation relation, nfloat multiplier, nfloat constant) { return NSLayoutConstraint.Create (view1, attribute1, relation, null, NSLayoutAttribute.NoAttribute, multiplier, constant); }
public SKKeyframeSequence(NSObject [] values, double [] times) : this(values, Convert (times)) { }
public bool SetValue(CGImageMetadataTag parent, NSString path, NSObject value) { if (value == null) throw new ArgumentNullException ("value"); return SetValue (parent, path, value.Handle); }