public void RegisterResponseHandler <T>(IpcCall call, IpcMessageHandler <T> handler) { responseHandlers[call] = (msg) => { return(handler?.Invoke(msg.As <T>()) ?? false); }; }
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); }
public void RegisterResponseHandler(IpcCall call, IpcMessageHandler handler) { responseHandlers[call] = handler; }
// TODO: Figure out how to handle generics here. public void RegisterRequestHandler(IpcCall call, IpcMessageHandler handler) { requestHandlers[call] = handler; }
/// <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)); }
public ReplyHandlerClass Request(IpcCall call, BaseMessage replyTo = null) { return(RequestInternal(call, null, replyTo)); }
public ReplyHandlerClass <TResponse> Send <T, TResponse>(IpcCall call, T data, BaseMessage replyTo = null) => new ReplyHandlerClass <TResponse>(SendInternal(call, data, replyTo));
protected abstract ReplyHandlerClass SendInternal(IpcCall call, object data, BaseMessage replyTo);