R
Ruslan Shlain
I am writing a Windows service. I have a timer that is set to 5 seconds. On
the elapsed event i stop my timer and i start a process that triggers an exe
app. It all works fine until I need to see when the exe finished its work. I
tried to use the following code to capture the event.
Any code samples or advice would be great.
This code is in Class1
static void Main(string[] args)
{
Class2 prc = new Class2();
prc.StartPrc();
//prc.StopPrc();
Console.ReadLine();
}
This code is in Class2.
public Class2()
{
prcImport = new Process();
prcImport.Exited += new EventHandler(Exited);
prcImport.StartInfo = new
ProcessStartInfo(@"C:\MyProjects\ImportWindowsService\ImportWindowsService\b
in\Debug\ImportWindowsService.exe");
}
public void StartPrc()
{
prcImport.Start();
}
private static void Exited(object sender, EventArgs e)
{
Console.WriteLine("{0}", sender.ToString());
}
the elapsed event i stop my timer and i start a process that triggers an exe
app. It all works fine until I need to see when the exe finished its work. I
tried to use the following code to capture the event.
Any code samples or advice would be great.
This code is in Class1
static void Main(string[] args)
{
Class2 prc = new Class2();
prc.StartPrc();
//prc.StopPrc();
Console.ReadLine();
}
This code is in Class2.
public Class2()
{
prcImport = new Process();
prcImport.Exited += new EventHandler(Exited);
prcImport.StartInfo = new
ProcessStartInfo(@"C:\MyProjects\ImportWindowsService\ImportWindowsService\b
in\Debug\ImportWindowsService.exe");
}
public void StartPrc()
{
prcImport.Start();
}
private static void Exited(object sender, EventArgs e)
{
Console.WriteLine("{0}", sender.ToString());
}