private void backgroundWorker3_DoWork(object sender1, DoWorkEventArgs e1) { AsynchronousSocketListener listen = e1.Argument as AsynchronousSocketListener; System.ComponentModel.BackgroundWorker worker; worker = (System.ComponentModel.BackgroundWorker)sender1; //e.Argument listen.eventFromNetworkClass += delegate(object sender, NetworkEventArgs e) { log.textBox1.Invoke((Action) delegate { log.textBox1.AppendText(e.Message); log.textBox1.AppendText(Environment.NewLine); }); }; listen.StartListening(worker, e1); }
private void listenConnectionsToolStripMenuItem_Click(object sender, EventArgs e) { log = new logNet(); listen = new AsynchronousSocketListener(this); //networkProtocol np = new networkProtocol(); //np.serverList = servers; if (!backgroundWorker3.IsBusy) { backgroundWorker3.RunWorkerAsync(listen); /* toolStripProgressBar1.Visible = true; * toolStripStatusLabel2.Text = "Waiting for serial ping"; * toolStripStatusLabel2.Visible = true;*/ log.StartPosition = FormStartPosition.Manual; log.Top = this.Top; log.Left = this.Left + this.Width; log.Show(); } else { MessageBox.Show("Not listening"); } }
private void listenConnectionsToolStripMenuItem_Click(object sender, EventArgs e) { log = new logNet(); listen = new AsynchronousSocketListener(this); //networkProtocol np = new networkProtocol(); //np.serverList = servers; if (!backgroundWorker3.IsBusy) { backgroundWorker3.RunWorkerAsync(listen); /* toolStripProgressBar1.Visible = true; toolStripStatusLabel2.Text = "Waiting for serial ping"; toolStripStatusLabel2.Visible = true;*/ log.StartPosition = FormStartPosition.Manual; log.Top = this.Top; log.Left = this.Left + this.Width; log.Show(); } else MessageBox.Show("Not listening"); }