I have a method that needs to shell out to get results.
I started by making a subclass of Thread called MyCommand.
In the ‘run’ method I created a new shell and used it in mode 0.
When the shell returned I raised an event to signal the thread had completed.
In the threadcomplete event handler I created another instance of MyCommand that takes the results of the previous command and then shelled out again to process the new command. Depending on the results of the first command there maybe dozens of subsequent commands to be executed.
During this process I am trying to update a progress bar on my application… i did this in the event handler of thread completed.
The result of all this is that the progress bar never got updated… It seems that the UI only gets updated when the last of the shells is completed.
My thought was … well let me get rid of the thread and try using mode 1 of the shell and update the UI when there is data available or when the command has completed…
So rather than create a second instance of MyCommand when the first completes I though maybe in the command completed event of shell I can simply execute the next command(s). Still I’m not convinced that I will solve my GUI update problems with this change.
Any thoughts? Timers etc?
P.S. These commands may take a few seconds each to complete…