waiting for users response
<p>when form is loaded <code>myMethod()</code> is called and then it executes some statements. at some point when it gets to if statement it should stop and wait for user to press some button and then it will continue executing according to what user did. i used <code>Thread.Sleep()</code> and ManualResetEvent obj's <code>WaitOne()</code> method but they seem to freeze the whole process nothing can be done until the time expires. I think that KeyEventHandler in should be run in background so it never feezzed... Anyway how can I do that ?</p>

<pre><code>public partial class Form1 : Form
{
    bool pressed = false;
    public Form1()
    {
        InitializeComponent();
        this.KeyPreview = true;
        this.KeyDown +=new KeyEventHandler(Form1_KeyDown);
    }

    void Form1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.E)
        {
            pressed = true;
        }
    }

    void myMethod()
    { 
        while (someBool)
        {
            //do something
            if (pressed)
            //do this
            else 
            //do that
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        myMethod();
    }
}
</code></pre>
