[Mono-list] Re: [Gtk-sharp-list] Timer, possible bug?
Hola Julio. Just include a aTimer.Stop(); after your while loop and you'll see how your program ends when 'q' is pressed. -- Antonio Martinez I Know it Antonio, but that not the way. I want my timer running executing OnTimedEvent every second until i enter q key. This little program would run fine, but may be there is a bug. I reported it. If you stop the timer then why a timer? ;-) regards Julio Jiménez ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
[Mono-list] Timer, possible bug?
why this little program never stop when timer is running? using System; using System.Timers; public class Timer1 { public static void Main() { System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed+=new ElapsedEventHandler(OnTimedEvent); // Set the Interval to 1 seconds. aTimer.Interval=1000; //aTimer.AutoReset = false; //aTimer.Enabled=true; aTimer.Start (); Console.WriteLine(Testing Timer, interval = 1 second. Press \'q\' to quit the sample.); while(System.Console.Read()!='q'); } // Specify what you want to happen when the Elapsed event is raised. private static void OnTimedEvent(object source, ElapsedEventArgs e) { Console.WriteLine(Hello World!); } } I think System.Console.Read() never ends regards Julio Jiménez ___ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list