void _graphControlClient_Closed(object sender, EventArgs e) { //make sure the channel scan box is closed if (ChannelScanComplete != null) { ChannelScanComplete.Invoke(this, new ChannelScanCompleteEventArgs(true)); } if ((ConnectionFaulted != null) && (this.Connected != ConnectionState.Disconnected)) { ConnectionFaulted.Invoke(this, new EventArgs()); } }
// TODO: Detect when WCF sends a closed signal public IServerService Connect(IClientCallback clientCallback) { InstanceContext context = new InstanceContext(clientCallback); DuplexChannelFactory <IServerService> channelFactory = new DuplexChannelFactory <IServerService>(context, new NetNamedPipeBinding(), new EndpointAddress(ConnectionConstants.EndpointFullAddress)); channelFactory.Closed += (sender, args) => ConnectionClosed?.Invoke(this, EventArgs.Empty); channelFactory.Faulted += (sender, args) => ConnectionFaulted?.Invoke(this, EventArgs.Empty); IServerService service = channelFactory.CreateChannel(); service.Connect(); return(service); }
private void OnConnectionFaulted(Exception ex) { IsFaulted = true; ConnectionFaulted?.Invoke(this, new ConnectionFaultedEventArgs(ex)); }