Example #1
0
        public void SetString(string value, string defaultName)
        {
            NSString str = new NSString(value);

            SetObjectForKey(str, defaultName);

            str.Dispose();
        }
Example #2
0
		public static void AddLoginItem (string path)
		{
			if (path == null)
				throw new ArgumentNullException ("path");
			var nspath = new NSString (path);

			MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr (class_ptr, selAddLoginItem, nspath.Handle);
			nspath.Dispose ();

		}
		public static void GlobalSetClassName (string name, Class kls)
		{
			if (name == null)
				throw new ArgumentNullException ("name");
			if (kls == null)
				throw new ArgumentNullException ("kls");

			var nsname = new NSString (name);
			MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle (selSetClassNameForClass_), nsname.Handle, kls.Handle);
			nsname.Dispose ();
		}
Example #4
0
		public CLRegion (CLLocationCoordinate2D center, System.Double radius, string identifier) : base (NSObjectFlag.Empty)
		{
			if (identifier == null)
				throw new ArgumentNullException ("identifier");
			var nsidentifier = new NSString (identifier);

			if (IsDirectBinding) {
				Handle = MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend_CLLocationCoordinate2D_Double_IntPtr (this.Handle, selInitCircularRegionWithCenterRadiusIdentifier, center, radius, nsidentifier.Handle);
			} else {
				Handle = MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CLLocationCoordinate2D_Double_IntPtr (this.SuperHandle, selInitCircularRegionWithCenterRadiusIdentifier, center, radius, nsidentifier.Handle);
			}
						nsidentifier.Dispose ();

		}
        public static void GlobalSetClassName(string name, Class kls)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (kls == null)
            {
                throw new ArgumentNullException("kls");
            }

            var nsname = new NSString(name);

            MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr(class_ptr, Selector.GetHandle(selSetClassNameForClass_), nsname.Handle, kls.Handle);
            nsname.Dispose();
        }
		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;
			}
		}
		public static CFHTTPMessage CreateRequest (Uri uri, string method, Version version)
		{
			CFUrl urlRef = null;
			NSString methodRef = null;

			var escaped = Uri.EscapeUriString (uri.ToString ());

			try {
				urlRef = CFUrl.FromUrlString (escaped, null);
				if (urlRef == null)
					throw new ArgumentException ("Invalid URL.");
				methodRef = new NSString (method);

				var msg = CreateRequest (urlRef, methodRef, version);
				if (msg == null)
					throw new ArgumentException ("Invalid URL.");

				return msg;
			} finally {
				if (urlRef != null)
					urlRef.Dispose ();
				if (methodRef != null)
					methodRef.Dispose ();
			}
		}