public void StartProcess(string process, string arguments, string startupDirectory, ProcessEndedHandler callback) { // change current directory savedDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = startupDirectory; // save callback processEndedHandler = callback; runningProcessNameRequest = process; mainForm.CallCommand("RunProcessCaptured", process + ";" + arguments); // ProcessStartedEventCaught() is called runningProcessNameRequest = null; }
public void StartProcess(string process, string arguments, string startupDirectory, ProcessEndedHandler callback) { // change current directory savedDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = startupDirectory; // save callback processEndedHandler = callback; runningProcessNameRequest = process; mainForm.CallCommand("RunProcessCaptured", process + ";" + arguments); // ProcessStartedEventCaught() is called runningProcessNameRequest = null; }
public void ProcessEndedEventCaught(string result) { // test if this process was started by us - we are assuming that FD can // only run one process at a time. if (runningProcessName != null) { bool success = result.EndsWith("(0)"); if (processEndedHandler != null) { processEndedHandler.DynamicInvoke(new object[] { success }); } // restore current directory Environment.CurrentDirectory = savedDirectory; processEndedHandler = null; runningProcessName = null; } }
public void ProcessEndedEventCaught(string result) { // test if this process was started by us - we are assuming that FD can // only run one process at a time. if (runningProcessName != null) { bool success = result.EndsWith("(0)"); if (processEndedHandler != null) { processEndedHandler.DynamicInvoke(new object[] { success }); } // restore current directory Environment.CurrentDirectory = savedDirectory; processEndedHandler = null; runningProcessName = null; } }