WaitforExit doesn't work correctly

后端 未结 4 2040
粉色の甜心
粉色の甜心 2021-01-21 02:19

So I have been battling this issue for awhile now and tried many different ways to fix it but cannot.

Bascally waht my app does is calls a java file to load an applica

4条回答
  •  孤城傲影
    2021-01-21 02:57

    Trying moving the WaitForExit call out of the UI thread.

    As @M. Babcock mentioned, you are holding up updates to the rich text box.

    A solution similar to this may work:

    Modify btnLoad_Click to start a new thread that processes the list (this goes in the count > 0 branch)

    Thread thread = new Thread(new ThreadStart(LoadPbThread));
    thread.Start();
    

    Then, add this:

    void LoadPbThread()
    {
        String toLoad;
        for (int i=0; i < count;i++)
        {//START OF FOREACH
            toLoad = lstBarToLoad.Items[i].Text;
            //call load method.
            loaddPB(toLoad);      
         }//end of for.
    }
    

提交回复
热议问题