コード例 #1
0
ファイル: SyncCallback.cs プロジェクト: uzbekdev1/WampSharp
 public SyncCallback(string procedureUri, MethodInfoHelper methodInfoHelper, object[] arguments, IOperationResultExtractor <TResult> extractor)
 {
     mMethodInfoHelper = methodInfoHelper;
     mLogger           = LogProvider.GetLogger(typeof(SyncCallback <TResult>) + "." + procedureUri);
     mArguments        = arguments;
     mExtractor        = extractor;
 }
コード例 #2
0
        private static InvokeAsyncDelegate <T> GetInvokeAsync <T>(MethodBase method, IOperationResultExtractor <T> extractor)
        {
            InvokeAsyncDelegate <T> result =
                (proxy, cancellationToken, arguments) =>
                proxy.InvokeAsync(method, extractor, cancellationToken, arguments);

            return(result);
        }
コード例 #3
0
        GetInvokeProgressiveAsync <T>(MethodBase method,
                                      IOperationResultExtractor <T> extractor)
        {
            InvokeProgressiveAsyncDelegate <T> result =
                (proxy, progress, cancellationToken, arguments) =>
                proxy.InvokeProgressiveAsync(method, progress, cancellationToken, extractor, arguments);

            return(result);
        }
コード例 #4
0
        private T InvokeSync <T>(MethodBase method,
                                 IOperationResultExtractor <T> valueExtractor,
                                 params object[] arguments)
        {
            MethodInfo methodInfo = (MethodInfo)method;

            return(mHandler.Invoke
                       (mInterceptor,
                       methodInfo,
                       valueExtractor,
                       arguments));
        }
コード例 #5
0
 private Task <T> InvokeProgressiveAsync <T>
     (MethodBase method,
     IProgress <T> progress,
     IOperationResultExtractor <T> resultExtractor,
     params object[] arguments)
 {
     return(InvokeProgressiveAsync <T>
                (method,
                progress,
                CancellationToken.None,
                resultExtractor,
                arguments));
 }
コード例 #6
0
        private Task <T> InvokeAsync <T>(MethodBase method,
                                         IOperationResultExtractor <T> valueExtractor,
                                         CancellationToken cancellationToken,
                                         params object[] arguments)
        {
            MethodInfo methodInfo = (MethodInfo)method;

            return(mHandler.InvokeAsync
                       (mInterceptor,
                       methodInfo,
                       valueExtractor,
                       arguments,
                       cancellationToken));
        }
コード例 #7
0
        private Task <T> InvokeProgressiveAsync <T>
            (MethodBase method,
            IProgress <T> progress,
            IOperationResultExtractor <T> resultExtractor,
            params object[] arguments)
        {
            MethodInfo methodInfo = (MethodInfo)method;

            return(mHandler.InvokeProgressiveAsync
                       (mInterceptor,
                       methodInfo,
                       resultExtractor,
                       arguments,
                       progress));
        }
コード例 #8
0
        public T Invoke <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments)
        {
            Type unwrapped = TaskExtensions.UnwrapReturnType(method.ReturnType);

            SyncCallback <T> callback = InnerInvokeSync <T>(interceptor, method, extractor, arguments, unwrapped);

            WaitForResult(callback);

            Exception exception = callback.Exception;

            if (exception != null)
            {
                throw exception;
            }

            return(callback.OperationResult);
        }
コード例 #9
0
 public AsyncOperationCallback(IOperationResultExtractor <TResult> extractor)
 {
     mExtractor = extractor;
 }
コード例 #10
0
        protected static InvokeProgressiveAsyncDelegate <T> GetInvokeProgressiveAsync <T>(MethodInfo method)
        {
            IOperationResultExtractor <T> extractor = GetExtractor <T>(method);

            return(GetInvokeProgressiveAsync(method, extractor));
        }
コード例 #11
0
 private Task <T> InvokeAsync <T>(MethodBase method,
                                  IOperationResultExtractor <T> valueExtractor,
                                  params object[] arguments)
 {
     return(InvokeAsync <T>(method, valueExtractor, CancellationToken.None, arguments));
 }
コード例 #12
0
 public ProgressiveAsyncOperationCallback(IProgress <TResult> progress,
                                          IOperationResultExtractor <TResult> extractor) :
     base(extractor)
 {
     mProgress = progress;
 }
コード例 #13
0
        public Task <T> InvokeProgressiveAsync <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments, IProgress <T> progress)
        {
            ProgressiveAsyncOperationCallback <T> asyncOperationCallback =
                new ProgressiveAsyncOperationCallback <T>(progress, extractor);

            Task <T> task = InnerInvokeAsync <T>(asyncOperationCallback, interceptor, method, arguments);

            return(task);
        }
コード例 #14
0
        public Task <T> InvokeAsync <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments)
        {
            AsyncOperationCallback <T> callback = new AsyncOperationCallback <T>(extractor);

            Task <T> task = InnerInvokeAsync <T>(callback, interceptor, method, arguments);

            return(task);
        }
コード例 #15
0
        private SyncCallback <T> InnerInvokeSync <T>(ICalleeProxyInterceptor interceptor, MethodInfo method, IOperationResultExtractor <T> extractor, object[] arguments, Type unwrapped)
        {
            MethodInfoHelper methodInfoHelper = new MethodInfoHelper(method);

            string procedureUri = interceptor.GetProcedureUri(method);

            SyncCallback <T> syncCallback = new SyncCallback <T>(procedureUri, methodInfoHelper, arguments, extractor);

            object[] argumentsToSend =
                methodInfoHelper.GetInputArguments(arguments);

            Invoke(interceptor, syncCallback, method, argumentsToSend);

            return(syncCallback);
        }