示例#1
0
 public void RegisterResponseHandler <T>(IpcCall call, IpcMessageHandler <T> handler)
 {
     responseHandlers[call] = (msg) =>
     {
         return(handler?.Invoke(msg.As <T>()) ?? false);
     };
 }
示例#2
0
        protected override ReplyHandlerClass SendInternal(IpcCall call, object data, BaseMessage replyToThis = null)
        {
            ReplyHandlerClass h = new ReplyHandlerClass(this);

            BaseMessage msg = IpcMessage.Send(call, data);

            msg.ReplyToId = replyToThis?.Id ?? Guid.Empty;

            PushMessage(msg, h);
            return(h);
        }
示例#3
0
 public void RegisterResponseHandler(IpcCall call, IpcMessageHandler handler)
 {
     responseHandlers[call] = handler;
 }
示例#4
0
        // TODO: Figure out how to handle generics here.

        public void RegisterRequestHandler(IpcCall call, IpcMessageHandler handler)
        {
            requestHandlers[call] = handler;
        }
示例#5
0
 /// <summary>
 /// Use this to send a strongly typed notification. Please use this rather than the weakly typed Send() function so as to reduce mismatched type errors.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="call"></param>
 /// <param name="data"></param>
 /// <param name="replyTo"></param>
 /// <returns></returns>
 public ReplyHandlerClass Send <T>(IpcCall call, T data, BaseMessage replyTo = null)
 {
     return(SendInternal(call, data, replyTo));
 }
示例#6
0
 public ReplyHandlerClass Request(IpcCall call, BaseMessage replyTo = null)
 {
     return(RequestInternal(call, null, replyTo));
 }
示例#7
0
 public ReplyHandlerClass <TResponse> Send <T, TResponse>(IpcCall call, T data, BaseMessage replyTo = null)
 => new ReplyHandlerClass <TResponse>(SendInternal(call, data, replyTo));
示例#8
0
 protected abstract ReplyHandlerClass SendInternal(IpcCall call, object data, BaseMessage replyTo);