コード例 #1
0
 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);
     }
 }
コード例 #2
0
 private void AddClient(Client client)
 {
     this.clients.Add(client);
     this.vm.Clients.Add(new ClientVm(client));
 }
コード例 #3
0
 public ClientVm(Client client)
 {
     this.client = client;
 }
コード例 #4
0
        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);
            }
        }