public void Start() { listening = true; listener.Start(); /*new Thread(delegate() * { * while(listening) * { * if (FrameQueue.Count > 0) * { * Bitmap frame = FrameQueue.Dequeue(); * * totalFrames++; * * //Bitmap[] tiles = new Bitmap[16]; * * /*int wid = frame.Width/10; * int height = frame.Height/10; * * for (int y = 0; y < 10; y++ ) * { * for(int x = 0; x < 10; x++) * { * Point point = new Point(wid * x, height * y); * Size size = new Size(wid, height); * Rectangle bounds = new Rectangle(point, size); * Bitmap tile = frame.Clone(bounds, PixelFormat.DontCare); * SendBitmap(tile); * } * }*/ /*if (frame != null) * SendBitmap(frame); * * //frame.Dispose(); * } * else * Thread.Sleep(1); * } * }).Start();*/ HandleClientsThread = new Thread(delegate() { while (listening) { try { ClientHandler client = new ClientHandler(listener.AcceptTcpClient(), (int a, int b, int c, int d, int e) => { this.UpdateMouse(a, b, c, d, e); }); Clients.Add(client); OnClientConnected(new ClientConnectedEventArgs(client)); client.ClientDisonnected += client_ClientDisonnected; } catch { } } }); HandleClientsThread.Start(); }
public ClientDisonnectedEventArgs(ClientHandler client) { this.Client = client; }