### GRAPHIC USER INTERFACE PER TEST SCRIPTS ###

#Caricamento classi di .NET Framework
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName PresentationFramework

#Definisco una finestra in cui è possibile aggiungere controlli.
$MainForm = New-Object System.Windows.Forms.Form
$MainForm.Text = 'Egt Version Tester'
$MainForm.Size = New-Object System.Drawing.Size(400,300)
$MainForm.StartPosition = 'CenterScreen'

#Definisco un testo per chiedere all'utente che programma vuole installare
$InstLabel = New-Object System.Windows.Forms.Label
$InstLabel.Location = New-Object System.Drawing.Point(20,20)
$InstLabel.Size = New-Object System.Drawing.Size(280,20)
$InstLabel.Text = 'Seleziona il programma da testare:'
$MainForm.Controls.Add($InstLabel)

#Definisco il bottone per lanciare installazione di EgtCAM5
$CAM5Button = New-Object System.Windows.Forms.Button
$CAM5Button.Location = New-Object System.Drawing.Point(40,40)
$CAM5Button.Size = New-Object System.Drawing.Size(100,23)
$CAM5Button.Text = 'EgtCAM5'
$CAM5Button.Add_Click({
    $MainForm.Close()
    $MainForm.Dispose()
    Powershell.exe -executionpolicy remotesigned -File .\GUI\EgtCAM5TestGUI.ps1
})
$MainForm.Controls.Add($CAM5Button)

#Definisco il bottone per lanciare installazione di BeamWall
$BWButton = New-Object System.Windows.Forms.Button
$BWButton.Location = New-Object System.Drawing.Point(40,70)
$BWButton.Size = New-Object System.Drawing.Size(100,23)
$BWButton.Text = 'BeamWall'
$BWButton.Add_Click({
    $MainForm.Close()
    $MainForm.Dispose()
    Powershell.exe -executionpolicy remotesigned -File .\GUI\EgtBeamWallTestGUI.ps1
})
$MainForm.Controls.Add($BWButton)

#Definisco un testo per chiedere all'utente se vuole copiare macchine dal server
$MachLabel = New-Object System.Windows.Forms.Label
$MachLabel.Location = New-Object System.Drawing.Point(20,110)
$MachLabel.Size = New-Object System.Drawing.Size(280,20)
$MachLabel.Text = 'Copia macchine dal server:'
$MainForm.Controls.Add($MachLabel)

#Definisco il bottone per copiare macchine dal server
$MachButton = New-Object System.Windows.Forms.Button
$MachButton.Location = New-Object System.Drawing.Point(40,130)
$MachButton.Size = New-Object System.Drawing.Size(100,23)
$MachButton.Text = 'Copia Macchine'
$MachButton.Add_Click({
    $MainForm.Close()
    $MainForm.Dispose()
    Powershell.exe -executionpolicy remotesigned -File .\GUI\MachGrabberGUI.ps1
})
$MainForm.Controls.Add($MachButton)

#Proprietà Topmost su $true per forzare l'apertura della finestra sopra altre finestre e finestre di dialogo aperte.
$MainForm.Topmost = $true

#Visualizzo il modulo:
$MainForm.ShowDialog()