-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasy-gui.ps1
124 lines (64 loc) · 2.59 KB
/
easy-gui.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#Generated Form Function
function GenerateForm {
########################################################################
# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.8.0
# Generated On: 7/3/2011 11:35 AM
# Generated By: sean.kearney
########################################################################
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname(“System.Windows.Forms”) | Out-Null
[reflection.assembly]::loadwithpartialname(“System.Drawing”) | Out-Null
#endregion
#region Generated Form Objects
$Gui = New-Object System.Windows.Forms.Form
$UnlockAccountButton = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#———————————————-
#Generated Event Script Blocks
#———————————————-
#Provide Custom Code for events specified in PrimalForms.
$handler_UnlockAccountButton_Click=
{
echo "PWSH-GUI 1.0"
}
$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
$Gui.WindowState = $InitialFormWindowState
}
#———————————————-
#region Generated Form Code
$Gui.Text = “PowerShell GUI”
$Gui.Name = “Gui”
$HelpDeskForm.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 265
$System_Drawing_Size.Height = 55
$Gui.ClientSize = $System_Drawing_Size
$UnlockAccountButton.TabIndex = 0
$UnlockAccountButton.Name = “UnlockAccountButton”
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 240
$System_Drawing_Size.Height = 23
$UnlockAccountButton.Size = $System_Drawing_Size
$UnlockAccountButton.UseVisualStyleBackColor = $True
$UnlockAccountButton.Text = “Run script”
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 13
$System_Drawing_Point.Y = 13
$UnlockAccountButton.Location = $System_Drawing_Point
$UnlockAccountButton.DataBindings.DefaultDataSourceUpdateMode = 0
$UnlockAccountButton.add_Click($handler_UnlockAccountButton_Click)
$Gui.Controls.Add($UnlockAccountButton)
#endregion Generated Form Code
#Save the initial state of the form
$InitialFormWindowState = $Gui.WindowState
#Init the OnLoad event to correct the initial state of the form
$Gui.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$script = $Gui.ShowDialog()| Read-Host 'script:'
} #End Function
#Call the Function
pwsh $script
echo 'Script finished.'
GenerateForm