private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { if (form != null) { form.Dispose(); } ImageSocket.CancelAsync(); CommandSocket.CancelAsync(); }
private void CommandSocket_DoWork(object sender, DoWorkEventArgs e) { commandClient = new TcpClient(); while (!commandClient.Connected) { try { commandClient.Connect("192.168.0.2", 50004); } catch (Exception exp) { } } commandStream = commandClient.GetStream(); CommandSocket.ReportProgress(100, detectedBarcode.State); }
private void Socket_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CommandSocket.RunWorkerAsync(); }