June 3rd, 2009, 02:24 AM
[RESOLVED] GUI app runs fast and then slows down
Program: Downloads thumbnails from photobucket.com galleries and displays them in ListView controls on the main form.
there is a ListView for each gallery that is downloaded. each gallery is chosen by a TabControl
also there is a second form that has a ListBox on it that lists the url's for download
My problem is that the GUI in my program works fine and all the thumbnails are added to the ListView pretty much instantly after its been downloaded. after a few galleries have been downloaded. the process of adding the thumbnails to the ListView is noticeably slow. even tho the thumbnails are already downloaded.
i am using threads in this program.
The main thread which is for the gui of the main form.
the 2nd form is running on its own thread.
a specified amount of threads are started to download images that are inserted in to a download queue (at the moment this is 10)
a thread is also added to add the images to the ListViews (this was an attempt to fix this problem and better then the previous way of adding the images)
link to gallery
-> download the gallery and extract the links to the thumbnails
-> each thumbnail link is inserted in to the download queue
loops till there is a link in the queue
-> downloads the thumbnail
-> the thumbnail image is inserted in to a List<> which holds information about the thumbnail
loops till there is a thumbnail in the List<>
-> creates a Bitmap of the image data
-> using .Invoke adds the Bitmap to a ImageList on the main form
-> using .Invoke adds an item to the ListView linking to the correct image
as i said it works nicely to start off with and then gradually the performance slows
any help will be appreciated
thank you in advance
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.