Task.Factory.StartNew(() =>
                {
                    //Load Data Here                   
                }).ContinueWith(r=>
                    {
                        //update ui
                    }, TaskScheduler.FromCurrentSynchronizationContext());
//TaskScheduler.FromCurrentSynchronizationContext() - this part of the code makes it ui thread safe

I can’t use c# 5 async feature yet but i don’t want to use background worker too
so i use TPL

Advertisements