private void button_runtest_Click(object sender, EventArgs e)
{
CultureInfo bz = new CultureInfo("en-BZ");
try
{
System.Diagnostics.ProcessStartInfo startInfo;
System.Diagnostics.Process process;
string save_directory = System.IO.Path.GetDirectoryName(this.save_filename);
string directory = save_directory;
string pyArgs = "";
pyArgs += " -f " + System.IO.Path.GetFileName(this.save_filename); //was .GetFileNameWithoutExtension(this.save_filename);
pyArgs += " -d " + this.numeric_dt.Value.ToString(bz);
pyArgs += " -T " + this.numeric_length.Value.ToString(bz);
string script = "run_test.py";
startInfo = new System.Diagnostics.ProcessStartInfo("Python.exe");
startInfo.WorkingDirectory = directory;
startInfo.Arguments = script + " " + pyArgs;
// startInfo.UseShellExecute = false;
// startInfo.CreateNoWindow = false;
// startInfo.RedirectStandardOutput = true;
// startInfo.RedirectStandardError = true;
process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
process.Start();
// process.WaitForExit();
// process.Close();
}
catch (Exception myex)
{
System.Windows.Forms.MessageBox.Show("Cannot execute the test Python program. \n - Make sure that you already saved with 'save test.py' enabled; \n - Make sure you have Python installed \n\n\nException:\n" + myex.ToString());
}
}