I am working on a application which downloads using
1) Parallel.ForEach(linklist, x => DownloadAsync(x));
2) webClient.DownloadStringAsync(new Uri(link.Url));
class Link
{
string url;
string result;
int progress;
}
and updates the datagridview using INotifyPropertyChanged.
The problem is that the download is real fast, the datagridview updates first row, then the UI does not update, but then on moving the mouse cursor on da开发者_开发知识库tagridview rows one by one each row updates values.
I don't understand where I am missing anything.
please any suggestings, thank you in advance.
EDIT: Async does not block the GUI, so i am not using background thread.
Although you don't show your code, I assume you are updating UI elements from backgroud thread, which is something you should never do. If you are targeting WinForms you need to use BackgroundWorker
or Control.Invoke
.
BackgroundWorker Component Overview
How to: Implement a Form That Uses a Background Operation
How can I update my user interface from a thread that did not create it?
Your objects, being bound, need to implement INotifyPropertyChanged
.
精彩评论