private void HeavyBackgroundWork()
     {
         Debug.WriteLine("Background thread: " + Thread.CurrentThread.ManagedThreadId);
         // To simulate a time-cost work.
         Thread.Sleep(1000);
         synchronizationContext.Post(new SendOrPostCallback(delegate(object param)
             {
                 // We have to access TextInfo by synchronizationContext, otherwise
                 // you will meet an exception.
                 TextInfo.Text = "HeavyBackgroundWork() has been finished.";
             }),
             null);
         Debug.WriteLine("HeavyBackgroundWork finished.");
     }
Another code formatter: http://www.manoli.net/csharpformat/.
But it seems that it's not friendly with blogspot.
 
 
No comments:
Post a Comment