示例#1
0
        public static Func <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> GetFunc <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) {
                return invoker.Invoke <TResult>(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 });
            });
        }
示例#2
0
        public static Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TCallback> GetAsyncAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName, HproseErrorEvent errorEvent)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, TCallback callback) {
                AsyncInvoke(invoker, methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 }, callback, errorEvent);
            });
        }
示例#3
0
        public static Action <T1, T2, T3, T4, T5, T6, TCallback> GetAsyncAction <T1, T2, T3, T4, T5, T6, TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName, HproseErrorEvent errorEvent)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, TCallback callback) {
                AsyncInvoke(invoker, methodName, new object[] { a1, a2, a3, a4, a5, a6 }, callback, errorEvent);
            });
        }
示例#4
0
        public static Action <T1, TCallback> GetAsyncAction <T1, TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName, HproseErrorEvent errorEvent)
        {
            return(delegate(T1 a1, TCallback callback) {
                AsyncInvoke(invoker, methodName, new object[] { a1 }, callback, errorEvent);
            });
        }
示例#5
0
        public static Action <T1, T2, T3> GetAction <T1, T2, T3>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3) {
                invoker.Invoke(methodName, new object[] { a1, a2, a3 });
            });
        }
示例#6
0
        public static Action <T1, T2, T3, T4, TCallback> GetAsyncAction <T1, T2, T3, T4, TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, TCallback callback) {
                AsyncInvoke(invoker, methodName, new object[] { a1, a2, a3, a4 }, callback, null);
            });
        }
示例#7
0
        public static Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TCallback> GetAsyncAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, TCallback callback) {
                AsyncInvoke(invoker, methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 }, callback, null);
            });
        }
示例#8
0
        public static Action GetAction(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate() {
                invoker.Invoke(methodName);
            });
        }
示例#9
0
        public static Action <TCallback> GetAsyncAction <TCallback>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(TCallback callback) {
                AsyncInvoke(invoker, methodName, nullArgs, callback, null);
            });
        }
示例#10
0
        public static Action <T1, T2, T3, T4, T5, T6> GetAction <T1, T2, T3, T4, T5, T6>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {
                invoker.Invoke(methodName, new object[] { a1, a2, a3, a4, a5, a6 });
            });
        }
示例#11
0
        public static Func <T1, T2, T3, T4, T5, T6, T7, T8, TResult> GetFunc <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) {
                return invoker.Invoke <TResult>(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8 });
            });
        }
示例#12
0
        public static Func <T1, T2, T3, T4, TResult> GetFunc <T1, T2, T3, T4, TResult>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4) {
                return invoker.Invoke <TResult>(methodName, new object[] { a1, a2, a3, a4 });
            });
        }
示例#13
0
        public static Func <TResult> GetFunc <TResult>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate() {
                return invoker.Invoke <TResult>(methodName);
            });
        }
示例#14
0
        public static Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> GetAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
#if !NET_2_0
            this
#endif
            HproseInvoker invoker, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) {
                invoker.Invoke(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 });
            });
        }
        public Task GetTask(HproseInvoker invoker, string methodName, object[] args, bool byRef, HproseResultMode resultMode, bool simple)
        {
#if dotNET45
            return(Task <T> .Run(delegate() {
                return invoker.Invoke <T>(methodName, args, byRef, resultMode, simple);
            }));
#else
            return(Task <T> .Factory.StartNew(delegate() {
                return invoker.Invoke <T>(methodName, args, byRef, resultMode, simple);
            }, default(CancellationToken), TaskCreationOptions.None, TaskScheduler.Default));
#endif
        }
示例#16
0
        private static void AsyncInvoke <TCallback>(HproseInvoker invoker, string methodName, object[] args, TCallback callback, HproseErrorEvent errorEvent)
        {
            if (callback is HproseCallback)
            {
                invoker.Invoke(methodName, args, callback as HproseCallback, errorEvent);
            }
            else if (callback is HproseCallback1)
            {
                invoker.Invoke(methodName, args, callback as HproseCallback1, errorEvent);
            }
            else
            {
#if Core
                TypeInfo type = callback.GetType().GetTypeInfo();
                if (type.IsGenericType)
                {
                    if (type.GetGenericTypeDefinition() == typeof(HproseCallback <>))
                    {
                        IInvokeHelper helper = Activator.CreateInstance(typeof(InvokeHelper <>).MakeGenericType(type.GenericTypeArguments)) as IInvokeHelper;
                        helper.Invoke(invoker, methodName, args, callback as Delegate, errorEvent, false, HproseResultMode.Normal, false);
                        return;
                    }
                    else if (type.GetGenericTypeDefinition() == typeof(HproseCallback1 <>))
                    {
                        IInvokeHelper1 helper = Activator.CreateInstance(typeof(InvokeHelper1 <>).MakeGenericType(type.GenericTypeArguments)) as IInvokeHelper1;
                        helper.Invoke(invoker, methodName, args, callback as Delegate, errorEvent, HproseResultMode.Normal, false);
                        return;
                    }
                }
#else
                Type type = callback.GetType();
                if (type.IsGenericType)
                {
                    if (type.GetGenericTypeDefinition() == typeof(HproseCallback <>))
                    {
                        IInvokeHelper helper = Activator.CreateInstance(typeof(InvokeHelper <>).MakeGenericType(type.GetGenericArguments())) as IInvokeHelper;
                        helper.Invoke(invoker, methodName, args, callback as Delegate, errorEvent, false, HproseResultMode.Normal, false);
                        return;
                    }
                    else if (type.GetGenericTypeDefinition() == typeof(HproseCallback1 <>))
                    {
                        IInvokeHelper1 helper = Activator.CreateInstance(typeof(InvokeHelper1 <>).MakeGenericType(type.GetGenericArguments())) as IInvokeHelper1;
                        helper.Invoke(invoker, methodName, args, callback as Delegate, errorEvent, HproseResultMode.Normal, false);
                        return;
                    }
                }
#endif
                throw new Exception("TCallback must be a Callback Delegate: HproseCallback, HproseCallback1, HproseCallback<T>, HproseCallback1<T>.");
            }
        }
 public HproseInvocationHandler(HproseInvoker invoker, String ns)
 {
     this.invoker = invoker;
     this.ns      = ns;
 }
示例#18
0
 public void Invoke(HproseInvoker invoker, string functionName, object[] args, Delegate callback, HproseErrorEvent errorEvent, HproseResultMode resultMode, bool simple)
 {
     invoker.Invoke <T>(functionName, args, (HproseCallback1 <T>)callback, errorEvent, resultMode, simple);
 }
示例#19
0
 public Task GetTask(HproseInvoker invoker, string methodName, object[] args, bool byRef, HproseResultMode resultMode, bool simple)
 {
     return(Task <T> .Run(delegate() {
         return invoker.Invoke <T>(methodName, args, byRef, resultMode, simple);
     }));
 }