internal void UpdateClientConnectionCount(bool increment) { if (increment) { Interlocked.Increment(ref clientConnectionCount); } else { Interlocked.Decrement(ref clientConnectionCount); } ClientConnectionCountChanged?.Invoke(this, EventArgs.Empty); }
public ProxyServerController(System.Windows.Threading.Dispatcher dispatcher) { // Guarda el dispatcher de Wpf Dispatcher = dispatcher; // Crea el objeto _proxyServer = new ProxyServer(); // Añade los manejadores de eventos _proxyServer.BeforeRequest += ProxyServer_BeforeRequest; _proxyServer.BeforeResponse += ProxyServer_BeforeResponse; _proxyServer.TunnelConnectRequest += ProxyServer_TunnelConnectRequest; _proxyServer.TunnelConnectResponse += ProxyServer_TunnelConnectResponse; // Asigna los manejadores de eventos _proxyServer.ClientConnectionCountChanged += (sender, args) => ClientConnectionCountChanged?.Invoke(this, new ConnectionCountEventArgs(_proxyServer.ClientConnectionCount)); _proxyServer.ServerConnectionCountChanged += (sender, args) => ServerConnectionCountChanged?.Invoke(this, new ConnectionCountEventArgs(_proxyServer.ServerConnectionCount)); }