Created
March 15, 2020 15:34
-
-
Save kccricket/a9f83712857bec1db7d6f510afacfbfd to your computer and use it in GitHub Desktop.
Check In
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-CheckInRequest { | |
$result = Invoke-RestMethod -Uri ''; | |
if ($result.data[0].status -eq "success") { | |
return $true; | |
} else { | |
return $false; | |
} | |
} | |
function Start-CheckIn { | |
$script:StatusLabel.text = "Contacting server..."; | |
$result = Invoke-CheckInRequest; | |
if ($result) { | |
$script:StatusLabel.text = "Check in completed."; | |
} else { | |
$script:StatusLabel.text = "Check in encountered an error." | |
} | |
} | |
Add-Type -AssemblyName System.Windows.Forms; | |
[System.Windows.Forms.Application]::EnableVisualStyles(); | |
$Form = New-Object system.Windows.Forms.Form; | |
$Form.ClientSize = '400,400'; | |
$Form.text = "Check In"; | |
$Form.TopMost = $false; | |
$CheckInButton = New-Object system.Windows.Forms.Button; | |
$CheckInButton.text = "Check In"; | |
$CheckInButton.width = 330; | |
$CheckInButton.height = 30; | |
$CheckInButton.Anchor = 'right,bottom,left'; | |
$CheckInButton.location = New-Object System.Drawing.Point(35,335); | |
$CheckInButton.Font = 'Lucida Sans Unicode,10'; | |
$StatusLabel = New-Object system.Windows.Forms.Label; | |
$StatusLabel.text = "Ready to check in..."; | |
$StatusLabel.AutoSize = $false; | |
$StatusLabel.width = 330; | |
$StatusLabel.height = 200; | |
$StatusLabel.location = New-Object System.Drawing.Point(35,35); | |
$StatusLabel.Font = 'Lucida Sans Unicode,22'; | |
$Form.controls.AddRange(@($CheckInButton,$StatusLabel)); | |
$CheckInButton.Add_Click({ | |
Start-CheckIn | |
}); | |
$Form.ShowDialog(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment