Esempio n. 1
0
        internal Response SubmitRequest(Uri uri, Request req)
        {
            var reqEvent = new RequestSendingEventArgs(uri, req);

            OnRequestSending(reqEvent);
            //Trace.TraceInformation("{0:HH:mm:ss.fff} [{1:d2}] Sending {2} to {3}",
            //    DateTime.Now, Thread.CurrentThread.ManagedThreadId, reqEvent.Request.ApiKey, reqEvent.Uri.AbsoluteUri);
            using (var connection = _connectionFactory.Connect(reqEvent.Uri)) {
                var resp = connection.Submit(reqEvent.Request);
                //Trace.TraceInformation("{0:HH:mm:ss.fff} [{1:d2}] Received {2} from {3}",
                //    DateTime.Now, Thread.CurrentThread.ManagedThreadId, resp.GetType().Name, reqEvent.Uri.AbsoluteUri);
                var respEvent = new ResponseReceivedEventArg(resp);
                OnResponseReceived(respEvent);
                return(respEvent.Response);
            }
        }
Esempio n. 2
0
 protected virtual void OnResponseReceived(ResponseReceivedEventArg @event)
 {
     ResponseReceived?.Invoke(this, @event);
 }