With a typical console application using timers, we can use 'Console.ReadLine()' to prevent the application from closing. Is there an equivalent solution when the console application's output type is 'Windows Application'?
Side-note: A windows service isn't the solution in this case, as I'm launching processes.
class Program
{
private static Timer _Timer;
static void Main(string[] args)
{
SetupTimer();
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Process.Start(@"C:\WINDOWS\system32\notepad.exe");
}
private static void SetupTimer()
{
_Timer = new Timer();
_Timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
_Timer.Interval = 3000;
_Timer.Enabled = true;
}
}