Form UI Freeezes even after using Backgroundworker when using Flickr.Net API

Topics: Developer Forum, Project Management Forum, User Forum
Jun 30, 2012 at 8:32 AM
Edited Jun 30, 2012 at 8:37 AM

Im working in winforms.I want upload some images using the API.The Images are uploaded but the User Interface freezes.I have inserted the code for uploading in a Background worker

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) 

 foreach (var item in imagelist)
flickr.UploadPicture(item, Path.GetFileName(item), null, null, true, false, true); 

The flickr object is created earlier from another form and passed to this form.I call the worker by


when a button is clicked.What is the Problem?

Jun 30, 2012 at 3:23 PM

I've written a test here and it works fine. I have a progress bar updating on the UI thread and the file uploading in a background worker and the progress bar never stops moving. I can also click into the text boxes etc.

As an aside, you probably shouldn't have a MessageBox in your DoWork event, but in the RunCompleted event.


Jul 1, 2012 at 4:23 AM


i had to use STA Thread to solve it.Can you post the Test project so that i can learn how to properly do it.


Jul 1, 2012 at 9:04 AM

A sample upload form has been added to the sample winforms project.

View the source code here: