Esempio n. 1
0
        public static Action <T1, T2, T3, T4, T5, T6, T7, TCallback> GetAsyncAction <T1, T2, T3, T4, T5, T6, T7, TCallback>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, TCallback callback) {
                AsyncInvoke(client, methodName, new object[] { a1, a2, a3, a4, a5, a6, a7 }, callback);
            });
        }
Esempio n. 2
0
        public static Action <TCallback> GetAsyncAction <TCallback>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(TCallback callback) {
                AsyncInvoke(client, methodName, nullArgs, callback);
            });
        }
Esempio n. 3
0
        public static Action GetAction(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate() {
                client.Invoke(methodName);
            });
        }
Esempio n. 4
0
 internal AsyncInvokeContextBase(HproseClient client, string functionName, object[] arguments, HproseErrorEvent errorCallback, Type returnType, bool byRef, HproseResultMode resultMode)
 {
     this.client        = client;
     this.functionName  = functionName;
     this.arguments     = arguments;
     this.errorCallback = errorCallback;
     this.returnType    = returnType;
     this.byRef         = byRef;
     this.resultMode    = resultMode;
 }
Esempio n. 5
0
        public static Func <T1, T2, T3, TResult> GetFunc <T1, T2, T3, TResult>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3) {
                return client.Invoke <TResult>(methodName, new object[] { a1, a2, a3 });
            });
        }
Esempio n. 6
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
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) {
                return client.Invoke <TResult>(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8 });
            });
        }
Esempio n. 7
0
        public static Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> GetAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
#if !NET_2_0
            this
#endif
            HproseClient client, 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) {
                client.Invoke(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14 });
            });
        }
Esempio n. 8
0
        public static Func <TResult> GetFunc <TResult>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate() {
                return client.Invoke <TResult>(methodName);
            });
        }
Esempio n. 9
0
        public static Action <T1, T2> GetAction <T1, T2>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2) {
                client.Invoke(methodName, new object[] { a1, a2 });
            });
        }
Esempio n. 10
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
            HproseClient client, 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, TCallback callback) {
                AsyncInvoke(client, methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 }, callback);
            });
        }
Esempio n. 11
0
        public static Action <T1, T2, T3, T4, T5> GetAction <T1, T2, T3, T4, T5>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {
                client.Invoke(methodName, new object[] { a1, a2, a3, a4, a5 });
            });
        }
Esempio n. 12
0
        public static Action <T1, T2, TCallback> GetAsyncAction <T1, T2, TCallback>(
#if !NET_2_0
            this
#endif
            HproseClient client, string methodName)
        {
            return(delegate(T1 a1, T2 a2, TCallback callback) {
                AsyncInvoke(client, methodName, new object[] { a1, a2 }, callback);
            });
        }
Esempio n. 13
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
            HproseClient client, 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 client.Invoke <TResult>(methodName, new object[] { a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 });
            });
        }
Esempio n. 14
0
 public AsyncInvokeContextBase(HproseClient client, string functionName, object[] arguments, HproseErrorEvent errorCallback, Type returnType, bool byRef, HproseResultMode resultMode, bool simple)
 {
     this.client        = client;
     this.functionName  = functionName;
     this.arguments     = arguments;
     this.errorCallback = (errorCallback == null) ? client.OnError : errorCallback;
     this.returnType    = returnType;
     this.byRef         = byRef;
     this.resultMode    = resultMode;
     this.simple        = simple;
     this.syncContext   = HproseClient.SynchronizationContext;
 }
Esempio n. 15
0
        private static void AsyncInvoke <TCallback>(HproseClient client, string methodName, object[] args, TCallback callback)
        {
            if (callback is HproseCallback)
            {
                client.Invoke(methodName, args, callback as HproseCallback);
            }
            else if (callback is HproseCallback1)
            {
                client.Invoke(methodName, args, callback as HproseCallback1);
            }
            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(client, methodName, args, callback as Delegate, false);
                        return;
                    }
                    else if (type.GetGenericTypeDefinition() == typeof(HproseCallback1 <>))
                    {
                        IInvokeHelper1 helper = Activator.CreateInstance(typeof(InvokeHelper1 <>).MakeGenericType(type.GenericTypeArguments)) as IInvokeHelper1;
                        helper.Invoke(client, methodName, args, callback as Delegate);
                        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(client, methodName, args, callback as Delegate, false);
                        return;
                    }
                    else if (type.GetGenericTypeDefinition() == typeof(HproseCallback1 <>))
                    {
                        IInvokeHelper1 helper = Activator.CreateInstance(typeof(InvokeHelper1 <>).MakeGenericType(type.GetGenericArguments())) as IInvokeHelper1;
                        helper.Invoke(client, methodName, args, callback as Delegate);
                        return;
                    }
                }
#endif
                throw new Exception("TCallback must be a Callback Delegate: HproseCallback, HproseCallback1, HproseCallback<T>, HproseCallback1<T>.");
            }
        }
 public HproseClientContext(HproseClient client)
 {
     this.client = client;
 }
Esempio n. 17
0
 internal AsyncInvokeContext1(HproseClient client, string functionName, object[] arguments, HproseCallback1 callback, HproseErrorEvent errorCallback, Type returnType, HproseResultMode resultMode) :
     base(client, functionName, arguments, errorCallback, returnType, false, resultMode)
 {
     this.callback = callback;
 }
 public HproseClientContext(HproseClient client) {
     this.client = client;
 }
Esempio n. 19
0
 internal AsyncInvokeContext(HproseClient client, string functionName, object[] arguments, HproseCallback callback, HproseErrorEvent errorCallback, Type returnType, bool byRef, HproseResultMode resultMode, bool simple) :
     base(client, functionName, arguments, errorCallback, returnType, byRef, resultMode, simple)
 {
     this.callback = callback;
 }
Esempio n. 20
0
 public static HproseClient Create(string uri)
 {
     return(HproseClient.Create(uri, HproseMode.MemberMode));
 }