private static MethodInfo GetMethodInfo(FunctionCallMessage functionCallMessage) { var t = typeof(T); var methodInfo = t.GetMethod(functionCallMessage.MethodName); return(methodInfo); }
private void SendFunctionCallToServer(MethodInfo methodInfo, object[] args) { var dispatchMessage = new FunctionCallMessage { MethodName = methodInfo.Name, Arguments = args }; var functionCallStr = _serializer.SerializeObject(dispatchMessage); _streamWriter.WriteLine(functionCallStr); }
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); }