Access the full text.
Sign up today, get DeepDyve free for 14 days.
CHAPTER 36 ■ ■ ■ Now that the basic outline of your DiskDiff application is done, it’s time to make it better. Populating on a Thread To make your application behave, you need to do the scan on a different thread so the user- interface thread can continue operating. In this example, you’ll use the Thread object from the System.Threading namespace. Starting the thread is easy: public void Populate() Thread t = new Thread(new ThreadStart(DoPopulate)); t.Start(); The function that will be called at the start of the thread is DoPopulate(). To create a new thread, a ThreadStart delegate must be created on the function you want called and passed to the thread. Then, the Start() member on the thread is called, and the thread starts and runs on its merry way. That gets the process working, but your app is now broken. When the DoTree() function in the form calls Populate(), it will start the thread and return immediately and then try to repaint the tree form. This is bad, because the information isn’t ready to paint yet. To fix this, you’ll add a new event to the DirectoryNode object for when the populate function is done: void DoPopulate()
Published: Jan 1, 2005
Keywords: File Object; Event Handler; Tree View; Object Node; Full Path
Read and print from thousands of top scholarly journals.
Already have an account? Log in
Bookmark this article. You can see your Bookmarks on your DeepDyve Library.
To save an article, log in first, or sign up for a DeepDyve account if you don’t already have one.
Copy and paste the desired citation format or use the link below to download a file formatted for EndNote
Access the full text.
Sign up today, get DeepDyve free for 14 days.
All DeepDyve websites use cookies to improve your online experience. They were placed on your computer when you launched this website. You can change your cookie settings through your browser.