[Mono-list] System.Timers

Jamil Geor jamil_geor@yahoo.co.nz
Wed, 03 Nov 2004 00:04:40 +1300


Sorry,
	Dumb mistake, it was just my code I forgot to start my timer.

new code:

		Timer myTimer = new Timer (3000);
		myTimer.Elapsed += new ElapsedEventHandler (MyTimeEvent);
		myTimer.Start ();


Thanks
Jamil
On Tue, 2004-11-02 at 23:55 +1300, Jamil Geor wrote:
> Hi,
> 	I am trying to run the code below, but it doesn't seem to work.  It
> should send output to the console after 3 seconds, but It doesn't seem
> to trigger off my event.  Is there something wrong with my code, or is
> it a problem with System.Timers?
> 
> I am using Mono 1.0.1
> 
> Here is the code:
> 
> using System;
> using System.Timers;
> 
> public class MyTime 
> {
> 	public static void Main (string [] args)
> 	{
> 		Timer myTimer = new Timer (3000);
> 		myTimer.Elapsed += new ElapsedEventHandler (MyTimeEvent);
> 
> 		while (Console.Read () != 'q');
> 	}
> 	
> 	private static void MyTimeEvent (object o, ElapsedEventArgs args)
> 	{
> 		Console.WriteLine ("Hello");
> 	}
> }
> 
> Thanks 
> Jamil
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list