public ChatClientHandler(NewEventArgs args) { this._eventArgs = args; this._backgroundWorker = new BackgroundWorker(); this._backgroundWorker.DoWork += DoWork; this._backgroundWorker.RunWorkerCompleted += backgroundRunWorkerCompleted; this._backgroundWorker.RunWorkerAsync(); }
private void backgroundDoWork(object sender, DoWorkEventArgs e) { this._listener.Start(); while (true) { NewEventArgs _newClient = new NewEventArgs(); _newClient.Client = this._listener.AcceptTcpClient(); /// fire join event this.JoinEvent(this, _newClient); } }