Exemplo n.º 1
0
        public string ProcessResponse(IIpcResponse response)
        {
            if (response.Success)
            {
                return(null);
            }
            var errorMessage = response.GetData <string>();

            return(errorMessage);
        }
Exemplo n.º 2
0
        public async Task <TResponse> RequestAsync <TResponse>(IIpcRequest packet) where TResponse : class, IIpcResponse
        {
            // add packet to requests
            PendingRequest request = _requestFactory.Create(packet);

            if (!_pendingRequests.TryAdd(packet.Id, request))
            {
                return(null);
            }

            // create the packet container
            PacketContainer container = _packetFactory.ToPacket(packet.GetType(), packet);

            await SendAsync(container);

            IIpcResponse tmp = await request.Response.Task;

            return(tmp as TResponse);
        }