Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -AssemblyName System.Windows.Forms
- [System.Windows.Forms.Application]::EnableVisualStyles()
- $congs = @(
- "Congregation 1",
- "Congregation 2",
- "Congregation 3",
- "Congregation 4",
- "Congregation 5",
- "Congregation 6",
- "Congregation 7",
- "Congregation 8",
- "Others"
- )
- $heigth = 55+ 55 * $congs.Length
- $MainForm = New-Object system.Windows.Forms.Form
- $MainForm.ClientSize = "300,$heigth"
- $MainForm.Text = "OnlyR Congregation selection"
- $MainForm.MaximizeBox = $false
- #$MainForm.Icon = New-Object System.Drawing.Icon("C:\Icons\onlyr.ico")
- $MainForm.ShowInTaskbar = $false
- $MainForm.BackColor = "#fefefe"
- $verStart = {
- $vers = $this.Text
- Remove-Item -Path $env:APPDATA\OnlyR\$vers -Recurse -erroraction 'silentlycontinue'
- New-Item -ItemType "directory" -Path $env:APPDATA\OnlyR\$vers
- Copy-Item $env:APPDATA\OnlyR\1 -Destination $env:APPDATA\OnlyR\$vers\1 -Recurse -Force
- & "C:\Program Files (x86)\OnlyR\OnlyR.exe" /id=$vers /nosettings
- $MainForm.Close()
- }
- $Label1 = New-Object system.Windows.Forms.Label
- $Label1.text = "Please select a congregation"
- $Label1.BackColor = "#ffc107"
- $Label1.ForeColor = "#000000"
- $Label1.TextAlign = 32
- #$Label1.AutoSize = $true
- $Label1.width = 300
- $Label1.height = 55
- $Label1.location = New-Object System.Drawing.Point(0,00)
- $Label1.Font = 'Microsoft Sans Serif,14,style=Bold'
- $btns = @($Label1)
- for ($i=0; $i -lt $congs.length; $i++){
- $cong = $congs[$i]
- $offset = 55 + $i * 55
- $Button1 = New-Object system.Windows.Forms.Button
- $Button1.text = $cong
- $Button1.width = 300
- $Button1.height = 50
- $Button1.location = New-Object System.Drawing.Point(0,$offset)
- $Button1.Font = 'Microsoft Sans Serif,14'
- $Button1.Add_Click($verStart)
- $btns += $Button1
- }
- $MainForm.controls.AddRange($btns)
- [void]$MainForm.ShowDialog()
Add Comment
Please, Sign In to add comment