public CalculatorConnection(ICalculatorClientAsync proxy, ClientEventSource eventSource, Guid id) { this.channel = (ICommunicationObject)proxy; ICalculatorClientAsync middle = new CalculatorClientWithEvents(proxy, eventSource); this.Instance = new CalculatorClientWithActivity(middle, eventSource, id); }
private static async Task RunClientAsync(Uri address, CancellationToken token) { ClientEventSource eventSource = ClientEventSource.Instance; NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); binding.OpenTimeout = TimeSpan.FromSeconds(1.0d); binding.SendTimeout = TimeSpan.FromSeconds(1.0d); binding.ReceiveTimeout = TimeSpan.FromSeconds(1.0d); binding.CloseTimeout = TimeSpan.FromSeconds(1.0d); CalculatorChannelFactory factory = new CalculatorChannelFactory(binding, new EndpointAddress(address), eventSource); await factory.OpenAsync(); ConnectionManager <ICalculatorClientAsync> connectionManager = new ConnectionManager <ICalculatorClientAsync>(factory); using (ProxyInvoker <ICalculatorClientAsync> proxy = new ProxyInvoker <ICalculatorClientAsync>(connectionManager)) { Random random = new Random(); while (!token.IsCancellationRequested) { try { await proxy.InvokeAsync(c => InvokeRandomAsync(random, c)); } catch (Exception) { } await Task.Delay(TimeSpan.FromMilliseconds(250.0d)); } } await factory.CloseAsync(); }
public CalculatorClientWithActivity(ICalculatorClientAsync inner, ClientEventSource eventSource, Guid clientId) { this.inner = inner; this.eventSource = eventSource; this.clientId = clientId; }
public CalculatorClientWithEvents(ICalculatorClientAsync inner, ClientEventSource eventSource) { this.inner = inner; this.eventSource = eventSource; }
public ConnectionWithEvents(IConnection <TProxy> inner, ClientEventSource eventSource, Guid id) { this.inner = inner; this.eventSource = eventSource; this.id = id; }
public CalculatorChannelFactory(Binding binding, EndpointAddress address, ClientEventSource eventSource) { this.factory = new ChannelFactory <ICalculatorClientAsync>(binding, address); this.eventSource = eventSource; }