private void cdpCaptureWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { CDPWorkerObject cdpWO = e.Result as CDPWorkerObject; if (progressBarWorker.IsBusy) { progressBarWorker.CancelAsync(); } if (cdpWO.capturedPacket == null) { cdpWO.communicator.Break(); MessageBox.Show("Timeout while capturing packets."); } else { cdpWO.callBack(cdpWO.capturedPacket); } } catch (Exception) { } }
private void cdpCaptureWorker_DoWork(object sender, DoWorkEventArgs e) { try { CDPWorkerObject cdpWO = e.Argument as CDPWorkerObject; cdpWO.captureCDP(); e.Result = cdpWO; } catch (Exception) { } }