private static bool CallCairoMethod(Cairo.Context cr, ref CairoInteropCall call)
        {
            if (call.ManagedMethod == null && !call.CallNative)
            {
                MemberInfo [] members = typeof(Cairo.Context).GetMember(call.Name, MemberTypes.Method,
                                                                        BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public);

                if (members != null && members.Length > 0 && members[0] is MethodInfo)
                {
                    call.ManagedMethod = (MethodInfo)members[0];
                }
                else
                {
                    call.CallNative = true;
                }
            }

            if (call.ManagedMethod != null)
            {
                call.ManagedMethod.Invoke(cr, null);
                return(true);
            }

            return(false);
        }
示例#2
0
        private static bool CallCairoMethod (Cairo.Context cr, ref CairoInteropCall call)
        {
            if (call.ManagedMethod == null && !call.CallNative) {
                MemberInfo [] members = typeof (Cairo.Context).GetMember (call.Name, MemberTypes.Method,
                    BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public);

                if (members != null && members.Length > 0 && members[0] is MethodInfo) {
                    call.ManagedMethod = (MethodInfo)members[0];
                } else {
                    call.CallNative = true;
                }
            }

            if (call.ManagedMethod != null) {
                call.ManagedMethod.Invoke (cr, null);
                return true;
            }

            return false;
        }