Repository navigation
Expand file tree
/
Copy pathgui.ps1
More file actions
223 lines (171 loc) · 6.02 KB
/
Copy pathgui.ps1
File metadata and controls
223 lines (171 loc) · 6.02 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# ==============================
# FORM
# ==============================
$form = New-Object System.Windows.Forms.Form
$form.Text = "eReuse Deployment Wizard"
$form.Size = New-Object System.Drawing.Size(1000,650)
$form.StartPosition = "CenterScreen"
$form.FormBorderStyle = "FixedDialog"
$form.MaximizeBox = $false
$form.BackColor = "White"
# ==============================
# LEFT SIDEBAR
# ==============================
$leftPanel = New-Object System.Windows.Forms.Panel
$leftPanel.Size = New-Object System.Drawing.Size(250,650)
$leftPanel.Location = New-Object System.Drawing.Point(0,0)
$leftPanel.BackColor = [System.Drawing.Color]::FromArgb(122, 193, 69)
$form.Controls.Add($leftPanel)
# ---- LOGO PLACEHOLDER ----
$logoPath = Join-Path $PSScriptRoot "assets\logo.png"
if (Test-Path $logoPath) {
$logoBox = New-Object System.Windows.Forms.PictureBox
$logoBox.Size = New-Object System.Drawing.Size(220,200)
$logoBox.Location = New-Object System.Drawing.Point(15,50)
$logoBox.SizeMode = "Zoom"
$logoBox.Image = [System.Drawing.Image]::FromFile($logoPath)
$leftPanel.Controls.Add($logoBox)
}
# ==============================
# HEADER PANEL
# ==============================
$headerPanel = New-Object System.Windows.Forms.Panel
$headerPanel.Size = New-Object System.Drawing.Size(750,80)
$headerPanel.Location = New-Object System.Drawing.Point(250,0)
$headerPanel.BackColor = "White"
$form.Controls.Add($headerPanel)
$titleLabel = New-Object System.Windows.Forms.Label
$titleLabel.Font = New-Object System.Drawing.Font("Segoe UI",24,[System.Drawing.FontStyle]::Bold)
$titleLabel.AutoSize = $true
$titleLabel.Location = New-Object System.Drawing.Point(20,25)
$headerPanel.Controls.Add($titleLabel)
# ==============================
# CONTENT PANEL
# ==============================
$contentPanel = New-Object System.Windows.Forms.Panel
$contentPanel.Size = New-Object System.Drawing.Size(750,450)
$contentPanel.Location = New-Object System.Drawing.Point(250,80)
$contentPanel.BackColor = "White"
$form.Controls.Add($contentPanel)
# ==============================
# BOTTOM PANEL
# ==============================
$bottomPanel = New-Object System.Windows.Forms.Panel
$bottomPanel.Size = New-Object System.Drawing.Size(1000,70)
$bottomPanel.Location = New-Object System.Drawing.Point(0,530)
$bottomPanel.BackColor = [System.Drawing.Color]::Gainsboro
$form.Controls.Add($bottomPanel)
$btnBack = New-Object System.Windows.Forms.Button
$btnBack.Text = "< Back"
$btnBack.Size = "90,30"
$btnBack.Location = "680,20"
$btnBack.Enabled = $false
$btnNext = New-Object System.Windows.Forms.Button
$btnNext.Text = "Next >"
$btnNext.Size = "90,30"
$btnNext.Location = "780,20"
$btnCancel = New-Object System.Windows.Forms.Button
$btnCancel.Text = "Cancel"
$btnCancel.Size = "90,30"
$btnCancel.Location = "880,20"
$btnCancel.Add_Click({ $form.Close() })
$bottomPanel.Controls.AddRange(@($btnBack,$btnNext,$btnCancel))
# ==============================
# WIZARD STATE
# ==============================
$currentStep = 0
# ==============================
# PAGE FUNCTIONS
# ==============================
function Show-Welcome {
$contentPanel.Controls.Clear()
$titleLabel.Text = "Welcome"
$label = New-Object System.Windows.Forms.Label
$label.Text = "Welcome to the eReuse Post Install Wizard.`n`nThis tool will guide you through preparing this PC for deployment.`nClick Next to continue."
$label.Font = New-Object System.Drawing.Font("Segoe UI",12)
$label.AutoSize = $true
$label.Location = "20,40"
$contentPanel.Controls.Add($label)
$btnBack.Enabled = $false
$btnNext.Text = "Next >"
}
function EnableNext {
$btnNext.Enabled = $true
}
function Show-Network {
$btnBack.Enabled = $true
$titleLabel.Text = "Network Setup"
# Dot-source module
& "$PSScriptRoot\scripts\net_reset.ps1" -ParentPanel $contentPanel
$btnNext.Text = "Next >"
}
function Show-Apps {
$contentPanel.Controls.Clear()
$titleLabel.Text = "Application Installation"
$placeholder = New-Object System.Windows.Forms.Label
$placeholder.Text = "Application install step placeholder.`n`n(Ninite or package logic goes here.)"
$placeholder.Font = New-Object System.Drawing.Font("Segoe UI",12)
$placeholder.AutoSize = $true
$placeholder.Location = "20,40"
$contentPanel.Controls.Add($placeholder)
$btnBack.Enabled = $true
$btnNext.Text = "Next >"
}
function Show-Activation {
$contentPanel.Controls.Clear()
$titleLabel.Text = "System Activation"
$placeholder = New-Object System.Windows.Forms.Label
$placeholder.Text = "Activation step placeholder.`n`n(Windows / Office activation logic goes here.)"
$placeholder.Font = New-Object System.Drawing.Font("Segoe UI",12)
$placeholder.AutoSize = $true
$placeholder.Location = "20,40"
$contentPanel.Controls.Add($placeholder)
$btnBack.Enabled = $true
$btnNext.Text = "Next >"
}
function Show-Finish {
$contentPanel.Controls.Clear()
$titleLabel.Text = "Completed"
$label = New-Object System.Windows.Forms.Label
$label.Text = "This PC is now ready for deployment.`n`nClick Finish to exit the wizard."
$label.Font = New-Object System.Drawing.Font("Segoe UI",12)
$label.AutoSize = $true
$label.Location = "20,40"
$contentPanel.Controls.Add($label)
$btnBack.Enabled = $true
$btnNext.Text = "Finish"
}
# ==============================
# NAVIGATION
# ==============================
function Show-Step {
switch ($currentStep) {
0 { Show-Welcome }
1 { Show-Network }
2 { Show-Apps }
3 { Show-Activation }
4 { Show-Finish }
}
}
$btnNext.Add_Click({
if ($script:currentStep -lt 4) {
$script:currentStep++
} else {
$form.Close()
return
}
Show-Step
})
$btnBack.Add_Click({
if ($script:currentStep -gt 0) {
$script:currentStep--
}
Show-Step
})
# ==============================
# START WIZARD
# ==============================
Show-Welcome
$form.ShowDialog()