Hello everyone!
I know how to use a Timer class:

static void Main(string[] args)
        {
            System.Timers.Timer MyTimer = new System.Timers.Timer();
            MyTimer.Elapsed += new System.Timers.ElapsedEventHandler(MyTimer_Elapsed);
            MyTimer.Interval = 2000;
            MyTimer.Enabled = true;
            //etc.
        }

        static void MyTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //do something every 2 seconds
        }

What I like to do is draw something every 2 secs during a draw method in a loop like:
>while condition true
> Draw object
> Wait 2 secs
>end loop after condition false

I could use a very long empty for loop as a wait method, is there a better way?
Have looked around here and there but found nothing usefull.
Any help (as always) is greatly appreciated:)

If you don't mind that the thread will halt for 2 seconds, you can use Thread.Sleep(2000).

Comments
you got it

Thanks DdoubleD!
That really helps. I was probably looking for the wrong words like pause and wait.:idea:

Thanks DdoubleD!
That really helps. I was probably looking for the wrong words like pause and wait.:idea:

I actually had flashbacks of that same thinking in the past... I was just hoping it was that simple.:P

Thanks to Intellisence I was even able to figure out I needed using System.Threading; Thanks again D!

This question has already been answered. Start a new discussion instead.