.net programming, computers and assorted technology rants

Building GUI Applications in PowerShell


Courtesy Doug Finke, Dr Dobbs

How many lines of PowerShell code are needed to create a complete working WPF application? Two!

It might seem surprising to write an article on developing UIs with PowerShell, Microsoft’s souped-up command-shell scripting language, but in reality, it makes a lot of sense. As developers, we need to deliver what the user wants, and that deliverable is sometimes a GUI. Being the lazy coder, I like to get my job done in the fewest lines of code possible. It’s quicker, easier, less error-prone, and simpler to maintain if it can be coded in PowerShell. To run the examples I present below, you’ll need ShowUI, the PowerShell module to help build WPF user interfaces in script.

Answer: Two Lines of Code

How many lines of PowerShell are needed to create a complete working WPF application? Two! Here’s the code that yields the result shown in Figure 1.

1 Import-Module ShowUI

2 Label "Hello World" -FontSize 42 –Show

Read More

http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898#

Advertisements

2 responses

  1. I didn’t even know a UI was possible with PowerShell. This would be great for creating a simple, updating UI for monitoring a running script. Nice post!

    April 25, 2013 at 9:48 pm

    • To tell you the truth I didn’t either. I definitely like the possibilities.

      April 25, 2013 at 10:10 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s