As I say, writing a
System.Windows.Forms
application in PowerShell is quite possible.
I've written this sample code write now while answering to this question. It tool me a couple of minutes. This is fully fledged minimalistic application, even with an event handler and few effects. Run it under PowerShell:
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object System.Windows.Forms.Form
$form.Text = "Hello, PowerShell!"
$form.Padding = 8
$label = New-Object System.Windows.Forms.Label
$label.Autosize = $false
$label.Dock = [System.Windows.Forms.DockStyle]::Top
$label.Text = "Click in the form and see what happens..."
$label.Parent = $form
$form.Add_Click($({
$this.Controls[0].Text = "Form clicked!"
$this.Controls[0].ForeColor = [System.Drawing.Color]::Red
}))
[System.Windows.Forms.Application]::Run($form)
[EDIT]
Also, you can embed Power Shell in .NET application. This CodeProject article will give you the idea:
How to run PowerShell scripts from C#[
^].
Additionally, you can support it by providing your own cmdlets to the script. Please see these CodeProject articles:
How to Write a Custom PowerShell Cmdlet - Part I[
^],
Build a PowerShell cmdlet[
^].
Good luck,
—SA