public void AddClient(object sender, EventArgs e) { //BUG: One client can connect multiply times. System.Diagnostics.Debug.Print("ClientsManager: Client trying to connect."); ClientThread clientThread = new ClientThread(sender as TcpClient); clientList.Add(clientThread); clientThread.ThreadStop += client_ThreadStop; clientThread.Start(); System.Diagnostics.Debug.Print("ClientsManager: Connect accepted."); }
public void FireEvent(ClientThread clientThread, Command command) { System.Diagnostics.Debug.WriteLine("ClientEvents: New message from client: {0}, {1}", command.CurrentCommand, command.Data); switch (command.CurrentCommand) { case "Exit": Exit(clientThread, new SocketEventArgs(command)); break; case "FullData": FullData(clientThread, new SocketEventArgs(command)); break; case "UpdateRecord": UpdateRecord(clientThread, new SocketEventArgs(command)); break; case "DeleteRecord": DeleteRecord(clientThread, new SocketEventArgs(command)); break; case "AddRecord": AddRecord(clientThread, new SocketEventArgs(command)); break; case "SendPhoto": SendPhoto(clientThread, new SocketEventArgs(command)); break; case "SendPhotoLink": SendPhotoLink(clientThread, new SocketEventArgs(command)); break; case "ReadPhoto": ReadPhoto(clientThread, new SocketEventArgs(command)); break; case "SendFile": SendFile(clientThread, new SocketEventArgs(command)); break; case "ReadFile": ReadFile(clientThread, new SocketEventArgs(command)); break; case "ReadPhotoLink": ReadPhotoLink(clientThread, new SocketEventArgs(command)); break; } }