void FinishCurrentRun() { m_ddd.SendStopScenarioRequest(); Thread.Sleep(2000); if (m_externalCommandProcess != null) { if (!m_externalCommandProcess.HasExited) { m_externalCommandProcess.Kill(); } m_externalCommandProcess = null; if (m_currentRun.ExternalTeardownCommand != String.Empty) { System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(); procInfo.FileName = m_currentRun.ExternalTeardownCommand; procInfo.WorkingDirectory = m_currentRun.ExternalTeardownWorkingDirectory; procInfo.Arguments = m_currentRun.ExternalTeardownArguments; procInfo.CreateNoWindow = true; System.Diagnostics.Process proc = System.Diagnostics.Process.Start(procInfo); Thread.Sleep(m_currentRun.ExternalTeardownDelay * 1000); if (!proc.HasExited) { proc.Kill(); } } } //TODO external command stop stuff statusRichTextBox.AppendText(String.Format("Finished run\n")); m_currentRun = null; if (Properties.Settings.Default.StopDDDServerBetweenRuns) { StopDDD(); } else { if (m_ddd != null) { m_ddd.ResetForNewSession(); } } StartNextRun(); }