mardi 16 juin 2009

Poshboard PowerShell Snapin

General Snapin and objects Architecture

Poshboard comes with a PowerShell Snapin with several cmdlets that generate PowerShell custom objects. These objects are then converted to Silverlight controls in Poshboard. The properties / methods used for these cmdlets are equivalent of Silverlight controls properties.

The logic of Silverlight objects is respected: you’ll find the corresponding properties of Silverlight controls in the PowerShell objects (It ease the learning process as you’ll find Silverlight sample on internet that you can convert to Poshboard PowerShell objects).

clip_image002

Note: not every Silverlight controls properties are available in Poshboard cmdlets, because they are not useful in the context of Poshboard (or due to a lack of time..). But the main idea was to keep the object model simple to understand. In the future, if some properties prove to be really needed, they will be added to the solution easely in future updates.

.NET developer that got previous experience on Silverlight development will also be able to rapidly develop PowerShell controls, as the logic is the same (but with the benefice of the Dynamic and model of PowerShell! )

Snapin relationship with PoshBoard and Silverlight

Poshboard use WCF to enable communicate between Silverlight clients (your web page) and the Poshboard server. PowerShell objects are created by the user scripts, and these objects are then converted to Silverlight control and dynamically added to the Silverlight GUI, along with the results of other PowerShell cmdlets (you can re use any kind of script that you already designed, or downloaded from internet)

clip_image002[5]

Sample Architecture of Poshboard Silverlight conversion of Visifire charts

Snapin Installation

Installing the snapin is really simple, you don’t even need to have Poshboard installed to use it and to design your future Silverlight objects.

Copy the two Dll from the Snapin zip file in a directory of your server or workstataion (Example : c:\ressources)

Launch the following line in a console (with administrator privilege in Vista / Seven / W2K8) :

  • For x86 Systems:

c:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe c:\ressources\poshboard.dll

  • For x64 systems:

c:\Windows\Microsoft.NET\Framework64\v2.0.50727\installutil.exe c:\ressources\poshboard.dll

You’re ready to script :

  • Open a PowerShell console, and type :

Add-PSSnapin poshboard

  • List all cmdlets

get-command *PB*

The Cmdlets

Here’s the list of these cmdlets:

Cmdlets

Description

New-PBAgDataGrid

Create a Silverlight DataGrid (based on DevExpress AgDataGrid control)

clip_image002[10]

New-PBButton

Create a Silverlight Button

clip_image004

New-PBChart

Create a Silverlight Chart (based on Visifire Charts control)

clip_image006

New-PBComboBox

Create a Silverlight ComboBox

clip_image008

New-PBContainer

Create a Silverlight Grid (container for other controls)

clip_image010

New-PBDataSerie

Create a DataSerie (used for Charts)

clip_image006[2]

New-PBElement

Create a blank Element

clip_image011

New-PBEvent

Create an event on a control

clip_image012

New-PBFlipBook

Create a FlipBook (based on SLMitsu Flip book control)

New-PBGridData

Create Data object for Datagrid

clip_image013

New-PBTextBlock

Create a Text Block control

clip_image015

New-PBTextBox

Create a TextBox control

clip_image017

Add-PBDataSerie

Add a DataSerie to a Chart object

clip_image006[3]

Add-PBElement

Add an Element to a container

clip_image010[1]

Add-PBEvent

Add an event to a control

clip_image012[1]

Add-PBGridData

Add Grid data to a Datagrid

clip_image002[11]

We will describe all these cmdlets and the corresponding controls in the next post.

Aucun commentaire: