private void AcceptClients() { try { this.listener = new TcpListener(IPAddress.Any, TcpClientReceivePort); this.listener.Start(); this.listener.BeginAcceptTcpClient((IAsyncResult ar)=> { try { var tcpClient = listener.EndAcceptTcpClient(ar); var client = new Client(this, tcpClient); this.AddClient(client); } catch (Exception ex) { MessageBox.Show(ex.Message); } }, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddClient(Client client) { this.clients.Add(client); this.vm.Clients.Add(new ClientVm(client)); }
public ClientVm(Client client) { this.client = client; }
private void SetActiveClient(Client c) { if (this.previewThread != null) { this.previewThread.Abort(); } if (c != null) { this.previewThread = new Thread(this.PreviewHandler); this.previewThread.IsBackground = true; this.previewThread.Start(c); } }