示例#1
0
 public PictureBoxObj GetEditablePictureBox(long controlID)
 {
     lock (_canvasSync)
     {
         PictureBoxObj c; _drawObjects.TryGetValue(controlID, out c);
         return(c);
     }
 }
示例#2
0
 public void AddDrawObject(long picID, DrawObject drawObj)
 {
     if (IsCleared || drawObj == null)
     {
         return;
     }
     lock (_canvasSync)
     {
         DrawObjectList drl;
         _editPBDrawObjects.TryGetValue(picID, out drl);
         if (drl != null)
         {
             drl.AddDrawObject(drawObj);
         }
     }
 }
示例#3
0
 public IConnector GetConnector(long connectionID)
 {
     lock (_cSync)
     {
         IConnector con = null;
         _connectors.TryGetValue(connectionID, out con);
         return(con);
     }
 }
示例#4
0
 private long GetPictureBoxAssociationID(long picID)
 {
     lock (_npbSync)
     {
         long serverID = 0;
         _clientServerPictureBoxID.TryGetValue(picID, out serverID);
         return(serverID);
     }
 }
示例#5
0
        public TeamPainterTCPClient GetClientByConnectionID(long connectionID)
        {
            long clientID = 0;

            lock (_cSync)
            {
                _clientConnectionAssociation.TryGetValue(connectionID, out clientID);
                TeamPainterTCPClient tp;
                _clients.TryGetValue(clientID, out tp);
                return(tp);
            }
        }
示例#6
0
        public bool AddClient(TeamPainterTCPClient client)
        {
            if (client == null || client.Connector == null)
            {
                return(false);
            }
            long connectionID = client.Connector.UniqueID;

            lock (_cSync)
            {
                TeamPainterTCPClient regcl;
                _clients.TryGetValue(client.UniqueID, out regcl);

                if (regcl != null)
                {
                    NetLogger.Log("This client is already exist");
                    return(false);
                }

                if (_clients.Count >= _maxClients)
                {
                    NetLogger.Log("Max connection");
                    return(false);
                }

                _clientConnectionAssociation[connectionID] = client.UniqueID;
                _clients[client.UniqueID] = client;

                client.Connector.DisconnectEvent += OnConnectorDisconnectHandler;

                client.Connector.ReceiveAction     = null;
                client.Connector.ReceiveAction    += OnReceveDataHandler;
                client.Connector.ReceiveComAction  = null;
                client.Connector.ReceiveComAction += OnReceiveCommandHandler;
                return(true);
            }
        }