Esempio n. 1
0
        public static void Call <TThis>(IntPtr info, Func <TThis, NSJSFunctionCallbackInfo, NSJSValue, NSJSValue> doo)
        {
            if (doo == null)
            {
                throw new ArgumentNullException("doo");
            }
            NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info);
            TThis self = NSJSKeyValueCollection.Get <TThis>(arguments.This);

            if (self == null)
            {
                Throwable.ObjectDisposedException(arguments.VirtualMachine);
            }
            else
            {
                try
                {
                    NSJSValue solt0 = arguments.Length > 0 ? arguments[0] : null;
                    doo(self, arguments, solt0);
                }
                catch (Exception exception)
                {
                    Throwable.Exception(arguments.VirtualMachine, exception);
                }
            }
        }
Esempio n. 2
0
        private static void GetOrSetProperty <TThis>(IntPtr info, Action <TThis, NSJSFunctionCallbackInfo> get, Action <TThis, NSJSFunctionCallbackInfo, NSJSValue> set)
        {
            if (info == NULL)
            {
                throw new ArgumentNullException("info");
            }
            if (get == null)
            {
                throw new ArgumentNullException("get");
            }
            if (set == null)
            {
                throw new ArgumentNullException("set");
            }
            NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info);
            TThis response = NSJSKeyValueCollection.Get <TThis>(arguments.This);

            if (response == null)
            {
                Throwable.ObjectDisposedException(arguments.VirtualMachine);
            }
            else
            {
                NSJSVirtualMachine machine = arguments.VirtualMachine;
                if (arguments.Length <= 0)
                {
                    get(response, arguments);
                }
                else
                {
                    try
                    {
                        set(response, arguments, arguments[0]);
                        arguments.SetReturnValue(true);
                    }
                    catch (Exception exception)
                    {
                        Throwable.Exception(arguments.VirtualMachine, exception);
                    }
                }
            }
        }