public EventListenerRequest(IEventContract contract, Cache cache) : base(contract.Reference, HttpMethod.Get) { this.contract = contract; this.cache = cache; cts = new CancellationTokenSource(); }
public void AddContract(IEventContract contract) { if (_contracts.Any(c => c.Name == contract.Name)) { throw new EventNameInUseException(contract.Name); } _contracts.Add(contract); }
public bool Equals(IEventContract other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Reference.Equals(other.Reference)); }
public bool Equals(IEventContract other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return Reference.Equals(other.Reference); }
public void RemoveEventListener(IEventContract contract) { CheckDisposed(); ArgUtils.CheckForNull(contract, nameof(contract)); EventListenerRequest eventListenerRequest; if (!eventListenerRequests.TryGetValue(contract, out eventListenerRequest)) return; eventListenerRequests.Remove(contract); eventListenerRequest.Stop(); }
public void RemoveEventListener(IEventContract contract) { CheckDisposed(); ArgUtils.CheckForNull(contract, nameof(contract)); EventListenerRequest eventListenerRequest; if (!eventListenerRequests.TryGetValue(contract, out eventListenerRequest)) { return; } eventListenerRequests.Remove(contract); eventListenerRequest.Stop(); }
public async void AddEventListener(IEventContract contract) { CheckDisposed(); ArgUtils.CheckForNull(contract, nameof(contract)); if (eventListenerRequests.ContainsKey(contract)) return; var eventListenerRequest = new EventListenerRequest(contract, new Cache()); eventListenerRequests.Add(contract, eventListenerRequest); HttpRequestMessage requestMessage = eventListenerRequest.CreateRequestMessage(Context); HttpResponseMessage httpResponseMessage = await SendRequestMessage(requestMessage, HttpCompletionOption.ResponseHeadersRead); eventListenerRequest.CreateResult(httpResponseMessage, Context); }
public async void AddEventListener(IEventContract contract) { CheckDisposed(); ArgUtils.CheckForNull(contract, nameof(contract)); if (eventListenerRequests.ContainsKey(contract)) { return; } var eventListenerRequest = new EventListenerRequest(contract, new Cache()); eventListenerRequests.Add(contract, eventListenerRequest); HttpRequestMessage requestMessage = eventListenerRequest.CreateRequestMessage(Context); HttpResponseMessage httpResponseMessage = await SendRequestMessage(requestMessage, HttpCompletionOption.ResponseHeadersRead); eventListenerRequest.CreateResult(httpResponseMessage, Context); }