public void Run(string exePath, bool listOnly, IEnumerable <String> cases) { BackgroundRunnerParameters p = new BackgroundRunnerParameters(exePath, listOnly, cases); worker.RunWorkerAsync(p); }
void worker_DoWork(object sender, DoWorkEventArgs e) { try { BackgroundRunnerParameters p = e.Argument as BackgroundRunnerParameters; if (p.ListOnly) { doListWork(p.ExePath, p.Cases); } else { doReportWork(p.ExePath, p.Cases); } } catch (Exception) { control.Invoke(new EventHandler(onInvalidTestCase)); } }