private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { var sendToBackgroundWorkerArgument = e.Argument as SendToBackgroundWorkerArgument; var backgroundWorker = sender as BackgroundWorker; ISelection selection = sendToBackgroundWorkerArgument.Selection; string dataPath = sendToBackgroundWorkerArgument.DataPath; IDataPacket dataPacket = selection.GetDataPacket(this); if (backgroundWorker.CancellationPending || dataPacket == null) { return; } // Saves the current selection to disk as one contiguous file IEnumerable <IDataPacket> dataPackets = Enumerable.Repeat(dataPacket, 1); _fileExport.SaveAsContiguousFile(dataPackets, Enumerable.Empty <IDetector>() /*don't care*/, dataPath, false /* no Forensic Integrity Log File */); string parameters = _parametersChecker.Substitute(_applicationParameters, selection, dataPacket, dataPath); if (!backgroundWorker.CancellationPending) { Process.Start(_applicationPath, parameters); } }