private void OnClientConnectHandler(object sender, IConnector connector) { btnConnect.Invoke((MethodInvoker) delegate { btnConnect.BackgroundImage = Properties.Resources.Connect; }); btnOptions.Invoke((MethodInvoker) delegate { btnOptions.Enabled = false; }); ATCPConnector atcp = connector as ATCPConnector; if (atcp != null) { _traffic.Subscribe(atcp); atcp.SendPacketSize = _config.SendPacketSize; atcp.SendInterval = _config.SendPacketInterval; } SendComLogin(); }
public TeamPainterTCPClient(ATCPConnector connector, long clientID, string name) { if (connector == null) { throw new ArgumentNullException("Connector is null"); } if (clientID == 0) { throw new ArgumentException("Incorrent uniqueID [0]"); } _clientID = clientID; _name = name; _syncronized = false; _connector = connector; _connector.DisconnectEvent += OnDisconnectEventHandler; _traffic = new TrafficCounter(100, 30); _traffic.Subscribe(connector); }