Recursive Call

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • slg

    Recursive Call

    Gurus, I have a Winform which has a button. When the button click function
    creates a thread.

    I want the thread to call the button click again . I can have only one
    instance of the
    thread running at a time.

    I want to automate testing of my function.
    Any thoughts.

    TIA

    private void btnProcessFiles _Click(object sender, EventArgs e)
    {

    Thread trd = new Thread(new ThreadStart(thi s.ThreadedProce ssFiles));
    trd.IsBackgroun d = true;
    trd.Start();
    }
    void ThreadedProcess Files()
    {
    // how can i call btnProcessFiles _Click
    }

  • Marc Gravell

    #2
    Re: Recursive Call

    You want to simulate pressing the button?
    Well, it could call someButton.Perf ormClick()? (making sure to switch back
    to the UI thread first - thread-affinity 'n'all).
    i.e. theButton.Begin Invoke((MethodI nvoker)theButto n.PerformClick) ;

    Marc


    Comment

    Working...