A simple Twitter client to demonstrate BackgroundWorker

5 04 2008

We have always had problems when we want to execute some operation that might take long time in a separate thread and at the same time updating UI components.

With BackgroundWorker class, we can simplify this process and makes it very simple for us to do asynchronous operations.

We initialize the BackgroundWorker and register for their events and run it asynchronously. So, when those events like WorkCompleted, ProgressChanged occurs, you are taken to your callback which is in the thread that started the BackgroundWorker.

BackgroundWorker LoginWorker = new BackgroundWorker();

LoginWorker.DoWork += new DoWorkEventHandler(worker_DoWork);

LoginWorker.RunWorkerCompleted +=new

RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

LoginWorker.WorkerSupportsCancellation = true;

I have developed a small (very) basic Twitter client to demonstrate the BackgroundWorker class

You can download the sample here

About these ads

Actions

Information

One response

4 05 2009
Faisal

Would it be possible for you to share the code ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: