April 9, 2004 .net

Jason Olson on Threading in Avalon

Jason Olson, an enterprising 3rd party, posts a look at the benefits of knowing about threading when building an entire UI stack from scratch. Instead of requiring you to transition from a worker thread to the UI thread to talk to a control, Avalon lets you grab the UI context that owns the control and party on:

void ShowProgress(int secondsElapsed) {

     try {


          txtSeconds.Text = secondsElapsed.ToString();


     finally {




This is far simpler code than what would be required in code based on User32. Nice.

UPDATE: Ian Griffiths points out that the code can be even sweeter!