Huddled Masses
The internet home of Joel "Jaykul" Bennett...
Browse: Home / PowerBoots 0.0.1 – A beginning (CTP3 only)

PowerBoots 0.0.1 – A beginning (CTP3 only)

By Joel 'Jaykul' Bennett on 05-Jan-2009

[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()

Similar Posts:

  • PowerBoots 0.3 – The Faster Edition
  • PowerBoots (Next Generation UI) WPF for PowerShell slides
  • ShowUI: the tutorial walkthrough
  • ShowUI: Handling Events and Producing Output
  • PowerShell Scripting Best Practices: Prefix A

Posted in Huddled | Tagged Development, PowerBoots, PowerShell, Scripting

« Previous Next »

Lijit Search

Tags

.Net .Net 2008 Scripting Games Automation Bugs Design Development Funny Gadgets GeoShell GUI Huddled Masses Internet licensing Microsoft Modules My Software News Personal PInvoke Pipeline Politics PoshCode PoshConsole PowerBoots PowerShell PowerShell Functions PowerTips Rants Recommender Repository Scripting ShowUI Software Solutions Textile Tips User Group UserInterface WalkThrough WebHosting Windows 7 WordPress WPF Xml

About Huddled Masses

This is web site is dedicated to the musings of Joel Bennett (aka Jaykul) about technology, software, software development, the web, and the world.

Any resemblance of the views expressed and the views of my employer, my terminal, or the view out my window are purely coincidental. The resemblance between them and my own views is non-deterministic. The question of the existence of views in the absence of anyone to hold them is left as an exercise for the reader.

P.S.: I occasionally link to things I think are great. When I do, I occasionally find a "referral code" so I can make a little cash. I promise that I don't link to anything just because of that cash (I wouldn't cross the street for the amount of cash those links bring in, never mind write a whole blog post) ... but I do not promise that things I link to will stay great as time passes, nor that you will agree with me about their greatness!

Archives

  • April 2012
  • February 2012
  • January 2012
  • October 2011
  • August 2011
  • July 2011
  • June 2011
  • March 2011
  • February 2011
  • January 2011

Copyright © 2012 Joel Bennett.

Powered by WordPress and Hybrid.