[new] You should check out the new release of PowerBoots, and the walkthrough PowerBoots Tutorial that I wrote up … this post is getting out of date. :)

If you haven’t seen the Ruby Shoes graphical framework, you should check it out. In fact, go read the tutorial and come back, because the rest of this will make a lot more sense then.

It’s a very slick toolkit, right?

From my previous post introducing PowerBoots

Well, here it is: PowerBoots 0.0.1

I hacked some things together in binary form, and Jeffrey Snover did some pure magic in a script, and after playing with various different mixes of it, I’m going to release the pure-script, CTP3-only, PowerBoots module now, and I’ll follow up with the backwards-compatible Out-WPF that gives you external threading later on.

I think you’ll find this is pretty slick already

Unpack the “PowerBoots” folder into one of your Module folders, and then just run imo PowerBoots and you’re off to the races. Imo is not short for immolate, nor for “in my opinion” ... it’s the alias for the newly renamed Import-Module cmdlet.

Once you’ve got that set up, check out the Demo-PowerBoots.ps1 script. Don’t just run it — open it in an editor and check it out, then run a few of the individual sections, and play with them to get a feel for how this works.

I’ll have more very soon, but for now, let me tantalize you with this little demo:


#Requires -version 2.0
#And requires -STA
Import-Module PowerBoots # http://huddledmasses.org/downloads/PowerBoots.7z
Import-Module HttpRest   # Version 1.0.1 http://www.poshcode.org/787

$url = "http://www.gutenberg.org/catalog/world/readfile"
function Update-Page($pg,$bk=53){
   @($textBox)[0].Text = Get-WebPageContent $url -with @{fk_files=$bk; pageno=$pg} //pre
   @($pageLabel)[0].Content = "Page: $pg"
}

#################
## The actual GUI code:
$window = Window -Title "Shakespeare's Richard III" -SizeToContent "WidthAndHeight" -Content (
            StackPanel -Children $(
              GridPanel -Children $(
                Image -Source 'http://huddledmasses.org/wordpress/wp-content/uploads/2009/01/eagle-crop.jpg' -height 250
                Label -Content "Richard III" -FontSize 52 -HorizontalAlignment Right -VerticalAlignment Bottom
              )
              StackPanel -Orientation Horizontal -Children $(
                Button -Content "Previous Page" -On_Click {Update-Page (--$page) $book}
                Label  -Content "Page $pg" -OutVariable PageLabel
                Button -Content "Next Page"     -On_Click {Update-Page (++$page) $book}
              )
              TextBox -OutVariable TextBox
            )
          )

$page=20; $book=53
Update-Page $page $book
$window.ShowDialog()

Comments are closed.