public void OnNewConnectionHandler(object sender, IConnector connector) { if (connector == null) { return; } lock (_cSync){ if (_connectors.Count > _maxCount) { connector.Disconnect(); return; } _connectors.Add(connector.UniqueID, connector); } connector.DisconnectEvent += OnConnectorDisconnectHandler; connector.ReceiveAction += OnReceveDataHandler; connector.ReceiveComAction += OnReceiveCommandHandler; NewConnectionEvent?.Invoke(this, connector); }
public void AddPictureObj(PictureBoxObj pic, Point location) { if (IsCleared || pic == null) { return; } lock (_canvasSync) { if (_drawObjects.ContainsKey(pic.UniqueID)) { return; } _backPicture.Controls.Add(pic); pic.Location = location; _drawObjects.Add(pic.UniqueID, pic); _editPBDrawObjects.Add(pic.UniqueID, new DrawObjectList(pic.UniqueID)); pic.Invalidate(); } AppLogger.Log("Created new pictureBox, location: " + location + " size: " + pic.Size); }