IMessage IMessageSink.SyncProcessMessage(IMessage msg) { Console.WriteLine("Remoting call:" + msg.Properties["__MethodName"]); MethodCall methodCall = new MethodCall(msg); if (methodCall.ArgCount == 1 && methodCall.Args[0] is Delegate) { Delegate realDelegate = methodCall.Args[0] as Delegate; methodCall.Args[0] = new EventForwarder(realDelegate).ProxyDelegate; } AsyncMessageResponseSink responseSink = new AsyncMessageResponseSink(); // Send the message nextSink.AsyncProcessMessage(methodCall, responseSink); return responseSink.WaitForResponse(); }
IMessage IMessageSink.SyncProcessMessage(IMessage msg) { Console.WriteLine("Remoting call:" + msg.Properties["__MethodName"]); MethodCall methodCall = new MethodCall(msg); if (methodCall.ArgCount == 1 && methodCall.Args[0] is Delegate) { Delegate realDelegate = methodCall.Args[0] as Delegate; methodCall.Args[0] = new EventForwarder(realDelegate).ProxyDelegate; } AsyncMessageResponseSink responseSink = new AsyncMessageResponseSink(); // Send the message nextSink.AsyncProcessMessage(methodCall, responseSink); return(responseSink.WaitForResponse()); }