none
why main thread is still working in threadpool

    Question

  • I wrote a code that i wan to call worker thread to get some info from wcf service , but when i debugg it, i find out that main thread is still running

     ThreadPool.QueueUserWorkItem(o =>
                    {
                        ServiceConnection sc = new ServiceConnection();
                           Deployment.Current.Dispatcher.BeginInvoke(()=>
                               {
                                  rowDetail rwdetail = new rowDetail(sc.getHistoryInformation(((Historyreport)e.AddedItems[0]).rowCode));
                                  rwdetail.Show();
                               }
                    );});
           

    Wednesday, April 18, 2012 4:19 AM

Answers

  • Deployment.Current.Dispatcher's thread *IS* the UI thread.  So basically you're starting a thread that executes something asynchronously on the main thread.

    Wednesday, April 18, 2012 8:06 AM