Or, use ReadLine and then check for a very deliberate entry such as QUIT or
STOP RIGHT NOW or whatever.
In the long run, an application like this, once tested, should probably be
turned into a Windows Service.
--Bob
"Glenn" <cs****@blackwinter.net> wrote in message
news:dd**************************@posting.google.c om...
What about
Console.ReadLine();
Just make sure no one touches the keyboard!
Glenn
"Kristoffer Persson" <hidden> wrote in message
news:<#F*************@TK2MSFTNGP10.phx.gbl>...
I have a small console app that has a Run method like this:
public void Run()
{
m_Timer = new System.Timers.Timer(1000);
m_Timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimer);
}
The problem is that the code obiously exits the Run method immediately.
What I want is for my application to do nothing but handle timer events and
recognize when it should be shut down.
Some sort of message loop perhaps?
- Kristoffer -