T
Tom P.
My basic problem is this: I have a background process that, while the
entire process takes too long to wait for, each piece causes the UI to
update more often and still results in a locked UI thread. I'm getting
a list of filesystem objects and inserting them into a listview. Being
on a network the file list can be huge, so I execute that part on a
BackgroundWorker thread. The problem is that every single filesystem
object makes the listview resort and repaint, this takes longer than
it does to get a filesystem object causing the UI to be updating so
much it's locked.
I'm figuring the best way to handle this is to get a filesystem object
then check the main UI and see if it's busy, if it is keep looping for
filesystem objects. If it's not busy then hand over the current list
of objects and let them be inserted.
But I can't find a way of getting the UI thread. How do I find the UI
thread from a BackgroundWorker object? Do I have to inherit override
the ctor to get the thread when the object is instantiated?
What do you guys think is the best way?
Tom P.
entire process takes too long to wait for, each piece causes the UI to
update more often and still results in a locked UI thread. I'm getting
a list of filesystem objects and inserting them into a listview. Being
on a network the file list can be huge, so I execute that part on a
BackgroundWorker thread. The problem is that every single filesystem
object makes the listview resort and repaint, this takes longer than
it does to get a filesystem object causing the UI to be updating so
much it's locked.
I'm figuring the best way to handle this is to get a filesystem object
then check the main UI and see if it's busy, if it is keep looping for
filesystem objects. If it's not busy then hand over the current list
of objects and let them be inserted.
But I can't find a way of getting the UI thread. How do I find the UI
thread from a BackgroundWorker object? Do I have to inherit override
the ctor to get the thread when the object is instantiated?
What do you guys think is the best way?
Tom P.