Invoke() private méthode

private Invoke ( IntPtr inst, IntPtr args, IntPtr kw ) : IntPtr
inst System.IntPtr
args System.IntPtr
kw System.IntPtr
Résultat System.IntPtr
Exemple #1
0
        //====================================================================
        // This is a hack. Generally, no managed class is considered callable
        // from Python - with the exception of System.Delegate. It is useful
        // to be able to call a System.Delegate instance directly, especially
        // when working with multicast delegates.
        //====================================================================

        public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw)
        {
            //ManagedType self = GetManagedObject(ob);
            IntPtr    tp = Runtime.PyObject_TYPE(ob);
            ClassBase cb = (ClassBase)GetManagedObject(tp);

            if (cb.type != typeof(System.Delegate))
            {
                Exceptions.SetError(Exceptions.TypeError,
                                    "object is not callable");
                return(IntPtr.Zero);
            }

            CLRObject    co    = (CLRObject)ManagedType.GetManagedObject(ob);
            Delegate     d     = co.inst as Delegate;
            BindingFlags flags = BindingFlags.Public |
                                 BindingFlags.NonPublic |
                                 BindingFlags.Instance |
                                 BindingFlags.Static;

            MethodInfo   method = d.GetType().GetMethod("Invoke", flags);
            MethodBinder binder = new MethodBinder(method);

            return(binder.Invoke(ob, args, kw));
        }
Exemple #2
0
 public virtual IntPtr Invoke(IntPtr target, IntPtr args, IntPtr kw, MethodBase info)
 {
     return(binder.Invoke(target, args, kw, info, this.info));
 }
Exemple #3
0
        //====================================================================
        // This is a hack. Generally, no managed class is considered callable
        // from Python - with the exception of System.Delegate. It is useful
        // to be able to call a System.Delegate instance directly, especially
        // when working with multicast delegates.
        //====================================================================

        public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw) {
            //ManagedType self = GetManagedObject(ob);
            IntPtr tp = Runtime.PyObject_TYPE(ob);
            ClassBase cb = (ClassBase)GetManagedObject(tp);

            if (cb.type != typeof(System.Delegate)) {
                Exceptions.SetError(Exceptions.TypeError, 
                                    "object is not callable");
                return IntPtr.Zero;
            }

            CLRObject co = (CLRObject)ManagedType.GetManagedObject(ob);
            Delegate d = co.inst as Delegate;
            BindingFlags flags = BindingFlags.Public | 
                                 BindingFlags.NonPublic |
                                 BindingFlags.Instance |
                                 BindingFlags.Static;

            MethodInfo method = d.GetType().GetMethod("Invoke", flags);
              MethodBinder binder = new MethodBinder(method);
             return binder.Invoke(ob, args, kw);
        }
Exemple #4
0
 internal void SetItem(IntPtr inst, IntPtr args)
 {
     SetterBinder.Invoke(inst, args, IntPtr.Zero);
 }
Exemple #5
0
 internal IntPtr GetItem(IntPtr inst, IntPtr args)
 {
     return(GetterBinder.Invoke(inst, args, IntPtr.Zero));
 }
Exemple #6
0
 internal void SetItem(BorrowedReference inst, BorrowedReference args)
 {
     SetterBinder.Invoke(inst, args, null);
 }
Exemple #7
0
 internal NewReference GetItem(BorrowedReference inst, BorrowedReference args)
 {
     return(GetterBinder.Invoke(inst, args, null));
 }