I have a problem here.....
I have a List of ProcessStartInfo as List<ProcessStartInfo>
I want to Start processes in Series
i.e
if i starts first process then second process in the List should start only when the first process (Exits or Aborts)...
I tries it like .....
private void startSeriesExecution()
{
List<string> programpath = new List<string>();
programpath.Add(@"C:\Program Files\Internet Explorer\iexplore.exe");
programpath.Add(@"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE");
foreach (var VARIABLE in programpath)
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = VARIABLE,
Arguments =
"www.google.com"
};
try
{
using (Process process=Process.Start(startInfo))
{
if (process.WaitForExit(Int32.MaxValue))
{
continue;
}
}
}
catch (Exception)
{
continue;
}
}
}
I am running startSeriesExecution
using a Custom Class for MultiThreading all the process execute at the same time....
private void Button_Click(object sender, RoutedEventArgs e)
{
// This function starts the Execution in different thread
Start.Work(startSeriesExecution).OnComplete(onSeriesExecutionComplete).Run();
}
Also one more thing i observed...
if 1 Process is already running... lets say IE is running already and now i executed startSeriesExecution()
and in this start an already running process (IE)... then the whole for loop is executed... i.e all the process in the list are executed...
Have have now no idea ho to proceed....