private void loadBatchButton_Click(object sender, EventArgs e) { // load stuff, if successful, change the state m_loadedRuns = RunInfo.LoadBatchFile(batchFilePathTextBox.Text); if (m_loadedRuns != null) { m_state = BatchRunnerState.Loaded; } UpdateView(); }
private void runBatchButton_Click(object sender, EventArgs e) { if (m_state == BatchRunnerState.Loaded) { m_state = BatchRunnerState.Running; StartNextRun(); } else if (m_state == BatchRunnerState.Running || m_state == BatchRunnerState.WaitingToResume) { m_loadedRuns.Clear(); FinishCurrentRun(); m_state = BatchRunnerState.Uninitialized; } UpdateView(); }
private void batchFileBrowseButton_Click(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog(); of.InitialDirectory = batchFilePathTextBox.Text; of.Title = "Open Batch File XML"; of.Filter = "XML (*.xml)|*.xml"; DialogResult r = of.ShowDialog(); if (r == DialogResult.OK) { batchFilePathTextBox.Text = of.FileName; Properties.Settings.Default.BatchFilePath = batchFilePathTextBox.Text; Properties.Settings.Default.Save(); m_state = BatchRunnerState.Uninitialized; } UpdateView(); }
private void goButton_Click(object sender, EventArgs e) { m_ddd.SendResumeScenarioRequest(); m_state = BatchRunnerState.Running; UpdateView(); }
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(); }