Ejemplo n.º 1
0
        protected static internal NSJSFunction GetFrameworkFunction(NSJSVirtualMachine machine, string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(null);
            }
            NSJSFunction function = null;

            lock (machine)
            {
                function = machine.GetData <NSJSFunction>(key);
                if (function == null)
                {
                    NSJSObject o = machine.Global;
                    function = o.Get(key) as NSJSFunction;
                    if (function == null)
                    {
                        throw new InvalidProgramException("Framework system internal function appears to be deleted");
                    }
                    function.CrossThreading = true;
                    machine.SetData(key, function);
                }
            }
            return(function);
        }
Ejemplo n.º 2
0
        private object InvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
        {
            NSJSObject global    = this.Value as NSJSObject;
            Exception  exception = null;
            object     result    = default(object);

            do
            {
                if (global == null)
                {
                    exception = new InvalidOperationException("The current call is missing an instance of the object");
                    break;
                }
                else
                {
                    NSJSVirtualMachine machine  = global.VirtualMachine;
                    NSJSFunction       function = global.Get(binder.Name) as NSJSFunction;
                    result = InternalInvokeTarget(function, args, binder.ReturnType, ref exception);
                }
                if (exception != null)
                {
                    throw exception;
                }
            } while (false);
            return(result);
        }
Ejemplo n.º 3
0
        public virtual object GetValue(Type type, string key)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (key.Length <= 0)
            {
                throw new ArgumentException("key");
            }
            NSJSObject owner = this.Value as NSJSObject;
            NSJSValue  value = null;

            if (owner != null)
            {
                value = owner.Get(key);
            }
            return(this.GetValue(type, value));
        }