示例#1
0
 public IPCRequest(IPCMessage requestMessage, Guid guid, RequestCallbackDelegate <T> callback, RequestCallbackErrorDelegate errorCallback, RequestCallbackDefaultDelegate defaultCallback, TimerEntry timeoutTimer)
 {
     this.RequestMessage  = requestMessage;
     this.Guid            = guid;
     this.Callback        = callback;
     this.ErrorCallback   = errorCallback;
     this.DefaultCallback = defaultCallback;
     this.TimeoutTimer    = timeoutTimer;
 }
示例#2
0
 public IPCRequest(IPCMessage requestMessage, Guid guid, RequestCallbackDelegate <T> callback, RequestCallbackErrorDelegate errorCallback,
                   RequestCallbackDefaultDelegate defaultCallback, TimedTimerEntry timeoutTimer)
 {
     RequestMessage  = requestMessage;
     Guid            = guid;
     Callback        = callback;
     ErrorCallback   = errorCallback;
     DefaultCallback = defaultCallback;
     TimeoutTimer    = timeoutTimer;
 }
示例#3
0
 public void SendRequest(IPCMessage message, RequestCallbackDelegate <CommonOKMessage> callback, RequestCallbackErrorDelegate errorCallback, RequestCallbackDefaultDelegate defaultCallback)
 {
     this.SendRequest <CommonOKMessage>(message, callback, errorCallback, defaultCallback, this.RequestTimeout * 1000);
 }
示例#4
0
 public void SendRequest <T>(IPCMessage message, RequestCallbackDelegate <T> callback, RequestCallbackErrorDelegate errorCallback, RequestCallbackDefaultDelegate defaultCallback) where T : IPCMessage
 {
     this.SendRequest <T>(message, callback, errorCallback, defaultCallback, this.RequestTimeout * 1000);
 }
示例#5
0
        public void SendRequest <T>(IPCMessage message, RequestCallbackDelegate <T> callback, RequestCallbackErrorDelegate errorCallback, RequestCallbackDefaultDelegate defaultCallback, int timeout) where T : IPCMessage
        {
            Guid guid = Guid.NewGuid();

            message.RequestGuid = guid;
            IPCRequest <T> request      = null;
            TimerEntry     timeoutTimer = this.RegisterTimer(delegate(int param0)
            {
                this.RequestTimedOut(request);
            }, timeout);

            request = new IPCRequest <T>(message, guid, callback, errorCallback, defaultCallback, timeoutTimer);
            lock (this.m_requests)
            {
                this.m_requests.Add(guid, request);
            }
            this.Send(message);
        }
示例#6
0
        public void SendRequest <T>(IPCMessage message, RequestCallbackDelegate <T> callback, RequestCallbackErrorDelegate errorCallback, RequestCallbackDefaultDelegate defaultCallback,
                                    int timeout) where T : IPCMessage
        {
            var guid = Guid.NewGuid();

            message.RequestGuid = guid;

            IPCRequest <T> request = null;

            if (timeout > 0)
            {
                var timer = RegisterTimer(delegate { RequestTimedOut(request); }, timeout);
                request = new IPCRequest <T>(message, guid, callback, errorCallback, defaultCallback, timer);
            }
            else
            {
                request = new IPCRequest <T>(message, guid, callback, errorCallback, defaultCallback, null);
            }

            lock (m_requests)
                m_requests.Add(guid, request);

            Send(message);
        }