void StartNextRun() { if (m_loadedRuns == null || m_loadedRuns.Count == 0) { statusRichTextBox.AppendText("Nothing to do...\n"); m_state = BatchRunnerState.Uninitialized; return; } if (m_ddd == null) { StartDDD(); } m_currentRun = m_loadedRuns[0]; m_loadedRuns.Remove(m_currentRun); m_currentRunFinishTime = m_currentRun.RunDuration * 1000; //m_ddd.ResetForNewSession(); String dataTag = dataTagTextBox.Text; if (m_currentRun.RunDataTag != String.Empty) { dataTag = m_currentRun.RunDataTag; } String logPath = logPathTextBox.Text; if (m_currentRun.RunLogDirectoryPath != String.Empty) { logPath = m_currentRun.RunLogDirectoryPath; } statusRichTextBox.AppendText("Starting new run:\n"); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "RunName", m_currentRun.RunName)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "RunScenarioPath", m_currentRun.RunScenarioPath)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "RunLogDirectoryPath", logPath)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "RunDataTag", dataTag)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "RunDuration", m_currentRun.RunDuration)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "ExternalCommandSetup", m_currentRun.ExternalSetupCommand)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "ExternalCommandSetupDelay", m_currentRun.ExternalSetupDelay)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "ExternalCommandTeardown", m_currentRun.ExternalTeardownCommand)); statusRichTextBox.AppendText(String.Format(" {0}: {1}\n", "ExternalCommandTeardownDelay", m_currentRun.ExternalTeardownDelay)); statusRichTextBox.Select(statusRichTextBox.Text.Length - 1, 0); statusRichTextBox.ScrollToCaret(); //m_ddd.SendStopScenarioRequest(); //Thread.Sleep(2000); m_ddd.SendLoadScenarioRequest(m_currentRun.RunScenarioPath, dataTag, logPath); Thread.Sleep(2000); if (m_currentRun.ExternalSetupCommand != String.Empty) { //TODO external command start stuff System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(); procInfo.FileName = m_currentRun.ExternalSetupCommand; procInfo.WorkingDirectory = m_currentRun.ExternalSetupWorkingDirectory; procInfo.Arguments = m_currentRun.ExternalSetupArguments + String.Format(" 1>>{0}\\{1}.log 2>&1", logPath, dataTag); procInfo.CreateNoWindow = true; m_externalCommandProcess = System.Diagnostics.Process.Start(procInfo); Thread.Sleep(m_currentRun.ExternalSetupDelay * 1000); } if (Properties.Settings.Default.RunNextAutomatically) { m_ddd.SendResumeScenarioRequest(); } else { m_state = BatchRunnerState.WaitingToResume; } UpdateView(); }