我启动了一个进程,用于process.exited
发送程序指令,说明如何处理该进程已完成。
它工作正常,但我需要向该Process_Exited()
方法发送一个参数。像这样的东西:
process.exited += Process_Exited(jobnumber);
但这不起作用。这是我的代码:
public void x264_thread(string jobnumber, string x264_argument, string audio_argument)
{
file = new System.IO.StreamWriter("c:\\output\\current.out");
mysqlconnect("UPDATE h264_encoder set status = 'running' where jobnumber = '" + jobnumber + "'");
var proc = new Process();
proc.StartInfo.FileName = "C:\\ffmbc\\ffmbc.exe";
proc.StartInfo.Arguments = x264_argument;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.EnableRaisingEvents = true;
proc.StartInfo.CreateNoWindow = true;
proc.ErrorDataReceived += proc_DataReceived;
proc.OutputDataReceived += proc_DataReceived;
proc.Exited += process_Exited(JobNumber); //This is where I would like to include a argument
proc.Start();
proc.BeginErrorReadLine();
proc.BeginOutputReadLine();
}
然后转到process_Exited
方法:
public void process_Exited(object sender, EventArgs e, string JobNumber) //This does not work. It does not pass the string JobNumber
{
//Do Stuff
}
我想向该process_Exited()
方法发送来自 x264_thread 的参数