C# - How can I block a method return for some interval of time?
I have a win forms application that contains a Web Browser control. I need to be able to add delay between operations on the web-browser due to the asynchronous nature of navigating. 

The Document_Complete event is worthless as it does not take into account that a page may contain multiple AJAX requests. The event ofter fires many times.

What I need is some way to delay the call of methods in the main thread. I have tried using a timer:

    private void startTimer()
            {
                timer.Interval = 2000;
                timer.Start();
                while (!BrowserIsReady)
                {
                    //Wait for timer
                }
            }

This locks up the thread and the tick event never fires. This loops never ends.

I want to run a series of methods like this:

    Navagate("http://someurl.com");
    //delay
    ClickALink();
    //delay
    Navagate("Http://somewhere.com");
    //delay

Can I solve this problem with a timer and the BackgroundWorker? Can someone suggest a possible solution?
C# - How can I block a method return for some interval of time?
===

I have a win forms application that contains a Web Browser control. I need to be able to add delay between operations on the web-browser due to the asynchronous nature of navigating. 

The Document_Complete event is worthless as it does not take into account that a page may contain multiple AJAX requests. The event ofter fires many times.

What I need is some way to delay the call of methods in the main thread. I have tried using a timer:

    private void startTimer()
            {
                timer.Interval = 2000;
                timer.Start();
                while (!BrowserIsReady)
                {
                    //Wait for timer
                }
            }

This locks up the thread and the tick event never fires. This loops never ends.

I want to run a series of methods like this:

    Navagate("http://someurl.com");
    //delay
    ClickALink();
    //delay
    Navagate("Http://somewhere.com");
    //delay

Can I solve this problem with a timer and the BackgroundWorker? Can someone suggest a possible solution?