Ejemplo n.º 1
0
        public JSArray(ExecutionContext GLOBAL, Array args)
        {
            this.GLOBAL = GLOBAL;
            int idx = 0;

            foreach (object a in args)
            {
                this[idx] = new JSSimpleProperty(idx.ToString(), JSObject.ToJS(GLOBAL, a));
                idx++;
            }
            MakeStdProperties(GLOBAL);
        }
Ejemplo n.º 2
0
 public override object Construct(ExecutionContext GLOBAL, JSObjectBase args, ExecutionContext x)
 {
     object[] arglist = null;
     foreach (ConstructorInfo c in mThisType.GetConstructors())
     {
         arglist = JSObject.SatisfyArgumentList(GLOBAL, args, c.GetParameters());
         if (arglist != null)
         {
             return(JSObject.ToJS(GLOBAL, c.Invoke(arglist)));
         }
     }
     throw new TypeError("Wrong argument types for " + mThisType.Name + " constructor");
 }
Ejemplo n.º 3
0
        public void TriggerEvent(object sender, EventArgs args)
        {
            object  senderOb = JSObject.ToJS(GLOBAL, sender), argsOb = JSObject.ToJS(GLOBAL, args);
            JSArray argArray = new JSArray(GLOBAL, new object[] { senderOb, argsOb });

            foreach (object ob in mHookedUp)
            {
                JSObjectBase obBase = ob as JSObjectBase;
                if (obBase != null)
                {
                    obBase.Call(GLOBAL, ob, argArray, GLOBAL.currentContext);
                }
            }
        }
Ejemplo n.º 4
0
        public override object Call(ExecutionContext GLOBAL, object t, JSObjectBase a, ExecutionContext x)
        {
            Delegate   d = mThisRef as Delegate;
            MethodInfo m = d.Method;

            if (d == null)
            {
                throw new TypeError(Class + " isn't callable");
            }

            object[] arglist = JSObject.SatisfyArgumentList(GLOBAL, a, m.GetParameters());
            if (arglist != null)
            {
                return(JSObject.ToJS(GLOBAL, d.DynamicInvoke(arglist)));
            }
            else
            {
                throw new TypeError("Wrong arguments for method " + m.DeclaringType.Name + "." + m.Name);
            }
        }
Ejemplo n.º 5
0
 public object GetValue(ExecutionContext GLOBAL)
 {
     return(JSObject.ToJS(GLOBAL, mFieldInfo.GetValue(mThisRef)));
 }
Ejemplo n.º 6
0
 public object GetValue(ExecutionContext GLOBAL)
 {
     return(JSObject.ToJS(GLOBAL, mPropertyInfo.GetValue(mThisRef, new object[] { })));
 }