162 lines
5.1 KiB
PowerShell
162 lines
5.1 KiB
PowerShell
#Generated Form Function
|
||
function GenerateForm {
|
||
########################################################################
|
||
# Code Generated By: SAPIEN Technologies PrimalForms v1.0.1.0
|
||
# Generated On: 25/01/2009 14:50
|
||
# Generated By: administrator
|
||
########################################################################
|
||
|
||
#region Import the Assembles
|
||
[reflection.assembly]::loadwithpartialname(“System.Windows.Forms”) | Out-Null
|
||
[reflection.assembly]::loadwithpartialname(“System.Drawing”) | Out-Null
|
||
#endregion
|
||
|
||
#region Generated Form Objects
|
||
$form1 = New-Object System.Windows.Forms.Form
|
||
$DisplayFile_Window = New-Object System.Windows.Forms.RichTextBox
|
||
$SelectFile_Window = New-Object System.Windows.Forms.RichTextBox
|
||
$SelectFile = New-Object System.Windows.Forms.Button
|
||
$groupBox1 = New-Object System.Windows.Forms.GroupBox
|
||
$Displayfile = New-Object System.Windows.Forms.Button
|
||
$openFileDialog1 = New-Object System.Windows.Forms.OpenFileDialog
|
||
#endregion Generated Form Objects
|
||
|
||
#———————————————-
|
||
#Generated Event Script Blocks
|
||
#———————————————-
|
||
#Provide Custom Code for events specified in PrimalForms.
|
||
$EnteredText=
|
||
{
|
||
$ifile = $SelectFile_Window.Text
|
||
}
|
||
|
||
$Displayfile_OnClick=
|
||
{
|
||
If(!$ifile -eq $False)
|
||
{
|
||
$iFileGC = Get-content $ifile
|
||
$iFileContents = [string]::join([environment]::NewLine,$iFileGC)
|
||
$DisplayFile_Window.Text = $iFileContents
|
||
}
|
||
Else {$DisplayFile_Window.Text = “No file selected”}
|
||
|
||
}
|
||
|
||
$SelectFile_OnClick=
|
||
{
|
||
$openFileDialog1.ShowDialog()
|
||
$ifile = $openFileDialog1.FileName
|
||
$SelectFile_Window.Text = $ifile
|
||
}
|
||
|
||
#———————————————-
|
||
#region Generated Form Code
|
||
$form1.Text = ‘My 1st Primal Form’
|
||
$form1.Name = ‘form1’
|
||
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 299
|
||
$System_Drawing_Size.Width = 436
|
||
$form1.ClientSize = $System_Drawing_Size
|
||
|
||
$DisplayFile_Window.WordWrap = $False
|
||
$DisplayFile_Window.Name = ‘DisplayFile_Window’
|
||
$DisplayFile_Window.Text = ”
|
||
$DisplayFile_Window.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||
$System_Drawing_Point.X = 10
|
||
$System_Drawing_Point.Y = 64
|
||
$DisplayFile_Window.Location = $System_Drawing_Point
|
||
$DisplayFile_Window.ReadOnly = $True
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 223
|
||
$System_Drawing_Size.Width = 409
|
||
$DisplayFile_Window.Size = $System_Drawing_Size
|
||
$DisplayFile_Window.TabIndex = 3
|
||
|
||
$form1.Controls.Add($DisplayFile_Window)
|
||
|
||
$SelectFile_Window.Multiline = $False
|
||
$SelectFile_Window.WordWrap = $False
|
||
$SelectFile_Window.Name = ‘SelectFile_Window’
|
||
$SelectFile_Window.Text = ”
|
||
$SelectFile_Window.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||
$System_Drawing_Point.X = 12
|
||
$System_Drawing_Point.Y = 35
|
||
$SelectFile_Window.Location = $System_Drawing_Point
|
||
$SelectFile_Window.EnableAutoDragDrop = $True
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 23
|
||
$System_Drawing_Size.Width = 293
|
||
$SelectFile_Window.Size = $System_Drawing_Size
|
||
$SelectFile_Window.TabIndex = 1
|
||
$SelectFile_Window.add_TextChanged($EnteredText)
|
||
|
||
$form1.Controls.Add($SelectFile_Window)
|
||
|
||
$SelectFile.TabIndex = 0
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 23
|
||
$System_Drawing_Size.Width = 27
|
||
$SelectFile.Size = $System_Drawing_Size
|
||
$SelectFile.Name = ‘SelectFile’
|
||
$SelectFile.UseVisualStyleBackColor = $True
|
||
|
||
$SelectFile.Text = ‘…’
|
||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||
$System_Drawing_Point.X = 311
|
||
$System_Drawing_Point.Y = 34
|
||
$SelectFile.Location = $System_Drawing_Point
|
||
|
||
$SelectFile.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$SelectFile.add_Click($SelectFile_OnClick)
|
||
|
||
$form1.Controls.Add($SelectFile)
|
||
|
||
$groupBox1.Name = ‘groupBox1’
|
||
|
||
$groupBox1.Text = ‘Select file to view’
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 284
|
||
$System_Drawing_Size.Width = 426
|
||
$groupBox1.Size = $System_Drawing_Size
|
||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||
$System_Drawing_Point.X = 3
|
||
$System_Drawing_Point.Y = 12
|
||
$groupBox1.Location = $System_Drawing_Point
|
||
$groupBox1.TabStop = $False
|
||
$groupBox1.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$groupBox1.TabIndex = 5
|
||
|
||
$form1.Controls.Add($groupBox1)
|
||
$Displayfile.TabIndex = 0
|
||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||
$System_Drawing_Size.Height = 23
|
||
$System_Drawing_Size.Width = 75
|
||
$Displayfile.Size = $System_Drawing_Size
|
||
$Displayfile.Name = ‘Displayfile’
|
||
$Displayfile.UseVisualStyleBackColor = $True
|
||
|
||
$Displayfile.Text = ‘Display file’
|
||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||
$System_Drawing_Point.X = 341
|
||
$System_Drawing_Point.Y = 22
|
||
$Displayfile.Location = $System_Drawing_Point
|
||
|
||
$Displayfile.DataBindings.DefaultDataSourceUpdateMode = 0
|
||
$Displayfile.add_Click($Displayfile_OnClick)
|
||
|
||
$groupBox1.Controls.Add($Displayfile)
|
||
|
||
$openFileDialog1.FileName = ‘openFileDialog1’
|
||
|
||
#endregion Generated Form Code
|
||
|
||
#Show the Form
|
||
$form1.ShowDialog()| Out-Null
|
||
|
||
} #End Function
|
||
|
||
#Call the Function
|
||
GenerateForm |