Inheritance: INativeObject, IDisposable
Ejemplo n.º 1
0
		static AccessoryInfo[] ExtractAccessoryInfo (IntPtr ptr, NSString id, NSString description)
		{
			using (var array = new CFArray (ptr)) {
				var res = new AccessoryInfo [array.Count];
				for (int i = 0; i < res.Length; ++i) {
					var dict = array.GetValue (i);
					var n = new NSNumber (CFDictionary.GetValue (dict, id.Handle));
					var desc = CFString.FetchString (CFDictionary.GetValue (dict, description.Handle));

					res [i] = new AccessoryInfo ((int) n, desc);
					id.Dispose ();
				}
				return res;
			}
		}
Ejemplo n.º 2
0
		public override void Dispose (CTParagraphStyleSettingValue[] values, int index)
		{
			values [index].pointer = IntPtr.Zero;
			value.Dispose ();
			value = null;
		}
Ejemplo n.º 3
0
		public IOHIDElement[] GetAllElements () {
			ThrowIfDisposed ();
			var arrayRef = IOHIDDeviceCopyMatchingElements (Handle, IntPtr.Zero, 0);
			if (arrayRef == IntPtr.Zero)
				return null;
			using (var array = new CFArray (arrayRef, true)) {
				var elements = new IOHIDElement[array.Count];
				for (int i = 0; i < elements.Length; i++)
					elements [i] = new IOHIDElement (array.GetValue (i), true);
				return elements;
			}
		}
Ejemplo n.º 4
0
		public CTParagraphStyleSpecifierIntPtrsValue (CTParagraphStyleSpecifier spec, IntPtr[] value)
			: base (spec)
		{
			this.value = CFArray.FromIntPtrs (value);
		}
Ejemplo n.º 5
0
		public IOHIDElement[] GetMatchingElements (IDictionary<string, ValueType> matchingDictionary) {
			ThrowIfDisposed ();
			if (matchingDictionary == null)
				throw new ArgumentNullException ("matchingDictionary");
			var matching = NSDictionary.FromObjectsAndKeys (matchingDictionary.Values.ToArray (),
			                                                matchingDictionary.Keys.ToArray ());
			var arrayRef = IOHIDDeviceCopyMatchingElements (Handle, matching.Handle, 0);
			if (arrayRef == IntPtr.Zero)
				return null;
			using (var array = new CFArray (arrayRef, true)) {
				var elements = new IOHIDElement[array.Count];
				for (int i = 0; i < elements.Length; i++)
					elements [i] = new IOHIDElement(array.GetValue (i), true);
				return elements;
			}
		}