Esempio n. 1
0
        private static MethodInfo GetMethodInfo(FunctionCallMessage functionCallMessage)
        {
            var t          = typeof(T);
            var methodInfo = t.GetMethod(functionCallMessage.MethodName);

            return(methodInfo);
        }
Esempio n. 2
0
        private void SendFunctionCallToServer(MethodInfo methodInfo, object[] args)
        {
            var dispatchMessage = new FunctionCallMessage {
                MethodName = methodInfo.Name, Arguments = args
            };
            var functionCallStr = _serializer.SerializeObject(dispatchMessage);

            _streamWriter.WriteLine(functionCallStr);
        }
Esempio n. 3
0
        private FunctionCallResult ExecuteMethodCallOnDispatcher(MethodInfo methodInfo, FunctionCallMessage functionCallMessage)
        {
            var functionCallResult = new FunctionCallResult();

            _dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
            {
                try
                {
                    functionCallResult.ReturnValue = methodInfo.Invoke(_instance, functionCallMessage.Arguments);
                    functionCallResult.DidSucceed  = true;
                }
                catch (Exception ex)
                {
                    functionCallResult.DidSucceed       = false;
                    functionCallResult.ExceptionMessage = ex.ToString();
                }
            }));
            return(functionCallResult);
        }