Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        // 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);
        }
Ejemplo n.º 3
0
 private void OnConnectionFaulted(Exception ex)
 {
     IsFaulted = true;
     ConnectionFaulted?.Invoke(this, new ConnectionFaultedEventArgs(ex));
 }