Esempio n. 1
0
        public void RemoveObjectForKey(string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("removeObjectForKey:"), intPtr);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
Esempio n. 2
0
        public void SetObjectForKey(NSObject obj, string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("setObject:forKey:"), obj.Handle, intPtr);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
Esempio n. 3
0
        public NSObject ObjectForKey(string key)
        {
            IntPtr handle = ObjC.ToNSString(key);
            var    value  = Runtime.GetNSObject <NSObject>(ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("objectForKey:"), handle));

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(value);
        }
Esempio n. 4
0
        public UIActivityViewController(string text, UIImage image)
        {
            IntPtr textHandle = ObjC.ToNSString(text);
            IntPtr array      = ObjC.ToNSArray(new[] { textHandle, image.Handle });

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithActivityItems:applicationActivities:"), array, IntPtr.Zero);
            ObjC.MessageSend(textHandle, Selector.ReleaseHandle);
        }
Esempio n. 5
0
        public string StringFromNumber(double number)
        {
            IntPtr handle = ObjC.ToNSNumber(number);
            string text   = ObjC.MessageSendString(Handle, Selector.GetHandle("stringFromNumber:"), handle);

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(text);
        }
Esempio n. 6
0
        public static string LocalizedStringFromNumber(double number, NSNumberFormatterStyle style)
        {
            IntPtr handle = ObjC.ToNSNumber(number);
            string text   = ObjC.MessageSendString(_classHandle, Selector.GetHandle("localizedStringFromNumber:numberStyle:"), handle, (int)style);

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(text);
        }
Esempio n. 7
0
        public new static NSMutableDictionary FromObjectAndKey(NSObject obj, string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);
            NSMutableDictionary nSObject = Runtime.GetNSObject <NSMutableDictionary>(ObjC.MessageSendIntPtr(_classHandle, Selector.GetHandle("dictionaryWithObject:forKey:"), obj.Handle, intPtr));

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(nSObject);
        }
Esempio n. 8
0
        public string StringFromNumber(double number)
        {
            IntPtr intPtr = ObjC.ToNSNumber(number);
            string result = ObjC.MessageSendString(Handle, Selector.GetHandle("stringFromNumber:"), intPtr);

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(result);
        }
Esempio n. 9
0
        public NSObject ObjectForKey(string key)
        {
            IntPtr   intPtr   = ObjC.ToNSString(key);
            NSObject nSObject = Runtime.GetNSObject <NSObject>(ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("objectForKey:"), intPtr));

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(nSObject);
        }
Esempio n. 10
0
        public NSObject AddObserver(string name, Action <NSNotification> action, NSObject fromObject = null)
        {
            var handler = new Observer(action);

            Callbacks.Subscribe(handler, SelectorName, n => action(Runtime.GetNSObject <NSNotification>(n)));
            ObjC.MessageSend(Handle, Selector.GetHandle("addObserver:selector:name:object:"), handler.Handle, Selector.GetHandle(SelectorName), name, fromObject == null ? IntPtr.Zero : fromObject.Handle);
            return(handler);
        }
Esempio n. 11
0
        public static NSDictionary FromObjectAndKey(NSObject obj, string key)
        {
            IntPtr handle     = ObjC.ToNSString(key);
            var    dictionary = Runtime.GetNSObject <NSDictionary>(ObjC.MessageSendIntPtr(_classHandle, Selector.GetHandle("dictionaryWithObject:forKey:"), obj.Handle, handle));

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(dictionary);
        }
Esempio n. 12
0
        public UIActivityViewController(string text)
        {
            IntPtr intPtr = ObjC.ToNSString(text);
            IntPtr arg    = ObjC.ToNSArray(new IntPtr[1]
            {
                intPtr
            });

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithActivityItems:applicationActivities:"), arg, IntPtr.Zero);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
Esempio n. 13
0
        public NSObject AddObserver(string name, Action <NSNotification> action, NSObject fromObject = null)
        {
            Observer observer = new Observer(action);

            Callbacks.Subscribe(observer, "__onNotification:", delegate(IntPtr n)
            {
                action(Runtime.GetNSObject <NSNotification>(n));
            });
            ObjC.MessageSend(Handle, Selector.GetHandle("addObserver:selector:name:object:"), observer.Handle, Selector.GetHandle("__onNotification:"), name, fromObject?.Handle ?? IntPtr.Zero);
            return(observer);
        }
Esempio n. 14
0
 public virtual void Dispose()
 {
     GC.SuppressFinalize(this);
     if (Handle != IntPtr.Zero)
     {
         Runtime.UnregisterNSObject(Handle);
         Callbacks.UnsubscribeAll(this);
         if (_shouldRelease)
         {
             ObjC.MessageSend(Handle, Selector.ReleaseHandle);
         }
     }
 }
Esempio n. 15
0
        public static IntPtr ToNSSet(string[] items)
        {
            IntPtr[] strings = new IntPtr[items.Length];
            for (int i = 0; i < items.Length; i++)
            {
                strings[i] = ToNSString(items[i]);
            }

            IntPtr array = ToNSArray(strings);
            IntPtr set   = ObjC.MessageSendIntPtr(GetClass("NSSet"), SetWithArraySelector.Handle, array);

            //Release everything
            for (int i = 0; i < strings.Length; i++)
            {
                ObjC.MessageSend(strings[i], Selector.ReleaseHandle);
            }

            return(set);
        }
Esempio n. 16
0
 //TODO: need to add the callback instead of using IntPtr.Zero
 public void DismissViewController(bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("dismissViewControllerAnimated:completion:"), animated, IntPtr.Zero);
 }
Esempio n. 17
0
 //TODO: need to add the callback instead of using IntPtr.Zero
 public void PresentViewController(UIViewController controller, bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("presentViewController:animated:completion:"), controller.Handle, animated, IntPtr.Zero);
 }
Esempio n. 18
0
 public void LoadView()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("loadView"));
 }
Esempio n. 19
0
 public SKProductsRequest(params string[] productIds)
 {
     ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithProductIdentifiers:"), ObjC.ToNSSet(productIds));
     ObjC.MessageSend(Handle, Selector.GetHandle("setDelegate:"), Handle);
 }
Esempio n. 20
0
 public void Cancel()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancel"));
 }
Esempio n. 21
0
 public void SetStatusBarHidden(bool hidden, bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("setStatusBarHidden:animated:"), hidden, animated);
 }
Esempio n. 22
0
 public void CancelAllLocalNotifications()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancelAllLocalNotifications"));
 }
Esempio n. 23
0
 public void ScheduleLocalNotification(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("scheduleLocalNotification:"), notification.Handle);
 }
Esempio n. 24
0
 public void PresentLocationNotificationNow(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("presentLocalNotificationNow:"), notification.Handle);
 }
Esempio n. 25
0
 public void RegisterUserNotificationSettings(UIUserNotificationSettings notificationSettings)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("registerUserNotificationSettings:"), notificationSettings.Handle);
 }
Esempio n. 26
0
 public void UnregisterForRemoteNotifications()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("unregisterForRemoteNotifications"));
 }
Esempio n. 27
0
 public static void ResetSystemTimeZone()
 {
     ObjC.MessageSend(_classHandle, Selector.GetHandle("resetSystemTimeZone"));
 }
Esempio n. 28
0
 public void CancelLocalNotification(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancelLocalNotification:"), notification.Handle);
 }
Esempio n. 29
0
 public void RegisterForRemoteNotificationTypes(UIRemoteNotificationType types)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("registerForRemoteNotificationTypes:"), (int)types);
 }
Esempio n. 30
0
 public void PlayInputClick()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("playInputClick"));
 }