public void process_Exited(object sender, System.EventArgs e) { if (this.InvokeRequired) { var myDelegate = new process_ExitedDelegate(process_Exited); this.BeginInvoke(myDelegate, new object[] { sender, e }); return; } var proc = sender as Process; Debug.Assert(proc != null); foreach (var test in Tests) { MultiProcessStatus mps = test as MultiProcessStatus; if (mps != null) { foreach (var tmp in mps.Processes) { if (tmp.Process == proc) { tmp.Stop(); if (mps.AllFinished()) { mps.Stop(); } } } continue; } ProcessStatus ps = test as ProcessStatus; if (null == ps) { continue; } if (proc != ps.Process) { continue; } ps.Stop(); } NotifyUiTestFinished(); }
public void process_Exited(object sender, System.EventArgs e) { if (this.InvokeRequired) { var myDelegate = new process_ExitedDelegate(process_Exited); this.BeginInvoke(myDelegate, new object[] { sender, e }); return; } var proc = sender as Process; Debug.Assert(proc != null); foreach (var test in Tests) { MultiProcessStatus mps = test as MultiProcessStatus; if (mps != null) { foreach (var tmp in mps.Processes) { if (tmp.Process == proc) { tmp.Stop(); if (mps.AllFinished()) mps.Stop(); } } continue; } ProcessStatus ps = test as ProcessStatus; if (null == ps) continue; if (proc != ps.Process) continue; ps.Stop(); } NotifyUiTestFinished(); }