From http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898?pgno=2