(view source code of airreggui.ps as plain text)
<#
.SYNOPSIS
Search for aircraft photos on Airport-data.com by the aircraft's registration number
.DESCRIPTION
This simple GUI script allows you to enter an aircraft registration and then search Airport-data.com for photos and specifications of that aircraft.
Interactive usage: enter an aircraft registration in the input texbox and press Enter or click the Search button to search Airport-data.com's website for photos and detailed specifications.
Command line usage: run this script with -Help parameter to view its command line syntax.
.NOTES
Dashes are mandatory in many aircraft registrations, but not all, e.g. PH-PBY and N1944S will work, but PHPBY and N-1944S won't.
Invalid command line switches starting with a dash will trigger a PowerShell error message.
All command line switches starting with a slash will trigger this script's help screen.
This script can be extended by using downloaded local aircraft registration databases; see this script's web page (see links section) for details.
Return code ("ErrorLevel") is 1 in case of errors, otherwise 0.
.PARAMETER AircraftRegistration
(optional) A valid aircraft registration, e.g. PH-PBY or N1944S or OK-NUL.
Aircraft registration may be entered in the GUI if not specified on the command line.
.PARAMETER SearchEngine
(optional) Alternative search engine if no match was found on Airport-data.com.
Valid SearchEngine values are 'DuckDuckGo', 'Google' (default) or 'StartPage'.
Useful only if local database extension scripts are installed.
Command line only, cannot be changed interactively in the GUI.
.PARAMETER Hide
Hides the console window (GUI remains visible).
Command line only, cannot be changed interactively in the GUI.
.PARAMETER Debug
Shows some progress messages, especially usefull when using local databases.
Command line only, cannot be changed interactively in the GUI.
.PARAMETER Version
Show this script's version number.
If combined with -Verbose show full script path, version number and last/modified/release date.
.PARAMETER Help
Shows this script's help screen, with more details than the Help button's help text.
.EXAMPLE
powershell . ./AirRegGUI.ps1
Will open the GUI with empty input textbox, the console remains visible
.EXAMPLE
powershell . ./AirRegGUI.ps1 -Hide
Will open the GUI with empty input textbox and hide the console
.EXAMPLE
powershell . ./AirRegGUI.ps1 N1944S
Will open the GUI with N1944S in input textbox, and start search immediately, the console remains visible
.EXAMPLE
powershell . ./AirRegGUI.ps1 -AircraftRegistration N1944S
Will open the GUI with N1944S in input textbox, and start search immediately, the console remains visible
.EXAMPLE
powershell . ./AirRegGUI.ps1 PH-PBY -Hide
Will open the GUI with PH-PBY in input textbox, start search immediately, and hide the console
.EXAMPLE
powershell . ./AirRegGUI.ps1 -AircraftRegistration PH-PBY -Hide
Will open the GUI with PH-PBY in input textbox, start search immediately, and hide the console
.LINK
Script written by Rob van der Woude:
https://www.robvanderwoude.com/airreg.php
.LINK
Airport-data API courtesy of Airport-data.com:
http://www.airport-data.com/api/doc.php
.LINK
Script created in Visual Studio Community 2019 with a trial version of Ironman Software's PowerShell Pro Tools Suite:
https://ironmansoftware.com/powershell-pro-tools/
.LINK
Capturing Enter key (as a work-around for the form's AcceptButton not working as expected) by sodawillow on StackOverflow.com:
https://stackoverflow.com/a/41441704
.LINK
Code to hide console window by Anthony on StackOverflow.com:
http://stackoverflow.com/a/15079092
.LINK
Use of Shown event (to make sure the GUI is visible before starting an optional immediate search) by Matthias Schippling on StackOverflow.com:
https://stackoverflow.com/a/219155
.LINK
Capture -Debug and -Verbose parameter by mklement0 on StackOverflow.com:
https://stackoverflow.com/a/48643616
.LINK
Embedded icon based on code by Theo on StackOverflow.com:
https://stackoverflow.com/a/53377253
.LINK
Airplane icon image courtesy of Icons8.com:
https://icons8.com/
#>
param (
[parameter( ValueFromPipeline )]
[ValidatePattern("(^\s*$|[\?/]|^\w[\w-]{2,3}\w+)")]
[string]$AircraftRegistration = '',
[parameter( ValueFromPipeline )]
[ValidateSet('DuckDuckGo','Google','StartPage')]
[string]$SearchEngine = 'Google',
[switch]$Hide,
[switch]$Help,
[switch]$Version
)
$progver = "2.16"
$AircraftRegistration = $AircraftRegistration.ToUpper( )
$Manufacturer = ''
$Model = ''
[bool]$Debug = $Debug -or ( $PSBoundParameters.ContainsKey( 'Debug' ) )
[bool]$Verbose = ( $PSBoundParameters.ContainsKey( 'Verbose' ) )
$global:notfound = $true
if ( $Version ) {
if ( $Verbose ) {
$lastmod = ( [System.IO.File]::GetLastWriteTime( $PSCommandPath ) )
if ( $lastmod.ToString( "h.mm" ) -eq $progver ) {
"`"{0}`", Version {1}, release date {2}" -f $PSCommandPath, $progver, $lastmod.ToString( "yyyy-MM-dd" )
} else {
# if last modified time is not equal to program version, the script has been tampered with
"`"{0}`", Version {1}, last modified date {2}" -f $PSCommandPath, $progver, $lastmod.ToString( "yyyy-MM-dd" )
}
} else {
$progver
}
exit 0
}
if ( $Help -or ( $AircraftRegistration -match "[/\?]" ) ) {
Clear-Host
Write-Host ( "`"{0}`", Version {1}" -f ( "$PSCommandPath" -replace "$PSScriptRoot","" ), $progver ) -NoNewline
$lastmod = ( [System.IO.File]::GetLastWriteTime( $PSCommandPath ) )
if ( $lastmod.ToString( "h.mm" ) -eq $progver ) {
Write-Host ", release date " -NoNewline
} else {
# if last modified time is not equal to program version, the script has been tampered with
Write-Host ", last modified date " -NoNewline
}
Write-Host $lastmod.ToString( "yyyy-MM-dd" )
Write-Host
Get-Help $PSCommandPath -Full
exit -1
}
$global:airportdatalink = ''
$Debug = ( $PSBoundParameters.ContainsKey( 'Debug' ) )
$defaulthelptext = "Enter an aircraft registration number, e.g. `"PH-PBY`" and click the Search button.`n`n" + `
"This script will then search Airport-Data.com for photos of the aircraft with that registration.`n`n" + `
"If found, a thumbnail of the photo will be displayed in this script's window, plus a button to view the photo full size in your default browser.`n`n" + `
"{0} 2022 Rob van der Woude`nhttps://www.robvanderwoude.com" -f [char]0x00A9
# Search query templates
if ( $SearchEngine -match '^DuckDuckGo$' ) {
$SearchEngine = 'DuckDuckGo'
$searchtemplate = "https://duckduckgo.com/html/?q=x{0}"
} elseif ( $SearchEngine -match '^Google$' ) {
$SearchEngine = 'Google'
$searchtemplate = "https://www.google.com/search?q={0}"
} elseif ( $SearchEngine -match '^Startpage$' ) {
$SearchEngine = 'StartPage'
$searchtemplate = "https://startpage.com/do/search?cat=web&cmd=process_search&language=english&engine0=v1all&query={0}"
} else {
if ( -not $Quiet ) {
Write-Host ( "Invalid -SearchEngine value `"{0}`", using Google instead" -f $SearchEngine )
}
$SearchEngine = 'Google'
$searchtemplate = "https://www.google.com/search?q={0}" # Google by default
}
if ( $Debug ) {
Write-Host ( "Search Engine: {0}" -f $SearchEngine )
Write-Host ( "Search template: {0}" -f $searchtemplate )
}
#######################################
# Hide console window #
# by Anthony on StackOverflow.com #
# http://stackoverflow.com/a/15079092 #
#######################################
$signature1 = @'
public static void ShowConsoleWindow( int state )
{
var handle = GetConsoleWindow( );
ShowWindow( handle, state );
}
[System.Runtime.InteropServices.DllImport( "kernel32.dll" )]
static extern IntPtr GetConsoleWindow( );
[System.Runtime.InteropServices.DllImport( "user32.dll" )]
static extern bool ShowWindow( IntPtr hWnd, int nCmdShow );
'@
# Hide console if requested
if ( $Hide ) {
$hideconsole = Add-Type -MemberDefinition $signature1 -Name Hide -Namespace HideConsole -ReferencedAssemblies System.Runtime.InteropServices -PassThru
$hideconsole::ShowConsoleWindow( 0 )
}
#######################
# End of Hide console #
#######################
###########################
# Start of Event handlers #
###########################
$ButtonHelp_Click = {
$scriptname = $PSCommandPath.Substring( $PSScriptRoot.Length )
$inserttext = "If local database extensions are installed, a local search will be initiated if no match was found online on Airport-data.com.`n" + `
"Local searches take considerably longer than online searches!`n" + `
"See https://www.robvanderwoude.com/airreg.php for details on local database extensions.`n`n" + `
"For detailed help use the command:`n`n" + `
" . '.{0}' -Help`n`nor:`n`n" -f $scriptname + `
" . '.{0}' /?`n`nor:`n`n" -f $scriptname + `
" Get-Help '.{0}' -Full`n`n" -f $scriptname + `
"Do you want to open this script's web page now?`n`n{1}" -f $scriptname, [char]0x00A9
$helptext = $defaulthelptext -replace [char]0x00A9, $inserttext
$title = "Help for {0}" -f $AirRegGUI.Text
$answer = [System.Windows.Forms.MessageBox]::Show( $helptext, $title, 'YesNo' )
if ( $answer -eq 'Yes' ) {
Start-Process 'https://www.robvanderwoude.com/airreg.php'
}
}
$ButtonOpenLink_Click = {
Start-Process $global:airportdatalink -WindowStyle 1
}
$ButtonSearch_Click = {
Search-Aircraft
}
$TextboxReg_KeyUp = {
Validate-Input( $_.KeyCode )
}
$TextboxReg_TextChanged = {
Validate-Input
}
$Window_Load = {
$AirRegGUI.Text = "AirRegGUI.ps1 - Version {0}" -f $progver # window title
$LabelHelptext.Text = $defaulthelptext # help text in window
}
$Window_Shown = {
if ( ![string]::IsNullOrWhiteSpace( $AircraftRegistration ) ) {
$TextboxReg.Text = $AircraftRegistration # enter specified aircraft registration in input textbox
$TextboxReg.SelectionStart = $TextboxReg.Text.Length # move cursor to end of input text
$TextboxReg.SelectionLength = 0
# Start search immediately
[System.Windows.Forms.Application]::DoEvents( ) # start updating GUI
Start-Sleep -Seconds 1 # allow GUI update to complete
Validate-Input( 'Return' )
}
}
#########################
# End of Event handlers #
#########################
function Check-Update( ) {
$ProgressPreference = 'SilentlyContinue'
$checkupdate = ( Invoke-WebRequest -Uri 'https://www.robvanderwoude.com/updates/airreg.txt' -TimeoutSec 10 )
$ProgressPreference = 'Continue'
if ( $checkupdate.StatusCode -eq 200 ) {
$latestversion = [float]$checkupdate.Content
$currentversion = [float]$progver
if ( $latestversion -gt $currentversion ) {
$title = 'Update Available'
$message = ( "An update for this script is available.`nYour current version is {0}, the latest version available is {1}.`n`n" + `
"Do you want to open the download page for the update?" -f ( $currentversion -replace ",","." ), ( $latestversion -replace ",","." ) )
$buttons = [System.Windows.Forms.MessageBoxButtons]::YesNo
if ( [System.Windows.Forms.MessageBox]::Show( $message, $title, $buttons ) -eq 'Yes' ) {
Start-Process 'https://www.robvanderwoude.com/airreg.php'
}
}
}
}
function Search-LocalDB( $message = 'Not found' ) {
[OutputType([bool])]
$prefix = ''
$registration = $TextboxReg.Text
$found = $false
if ( $registration.Contains( '-' ) ) {
$prefix = $registration.Split( '-' )[0]
} else {
if ( Test-Path ( "$PSScriptRoot\AirReg{0}Cmd.ps1" -f $registration.Substring( 0, 2 ) ) -PathType 'Leaf' ) {
$prefix = $registration.Substring( 0, 2 )
} elseif ( Test-Path ( "$PSScriptRoot\AirReg{0}Cmd.ps1" -f $registration.Substring( 0, 1 ) ) -PathType 'Leaf' ) {
$prefix = $registration.Substring( 0, 1 )
} else {
$prefix = ''
}
}
if ( -not [string]::IsNullOrWhiteSpace( $prefix ) ) {
$localDBscript = ( Join-Path -Path $PSScriptRoot -ChildPath ( "AirReg{0}Cmd.ps1" -f $prefix ) )
if ( $Debug ) {
Write-Host ( "Found local '{0}' database file `"{1}`"" -f $prefix, $localDBscript )
}
$ButtonOpenLink.Visible = $false
$LabelPhotographer.Visible = $false
$PictureboxThumbnail.Visible = $false
$ButtonOpenLink.Enabled = $false
$LabelHelptext.Text = "Searching local database, this may take a while..."
$LabelHelptext.Visible = $true
[System.Windows.Forms.Application]::DoEvents( ) # update GUI
$Manufacturer = ''
$Model = ''
if ( $Debug ) {
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew( )
Write-Host ( "Start searching local database at {0}" -f ( Get-Date ) )
if ( ( Get-Content $localDBscript ) -match 'TerminateExcel' ) {
Write-Host ( "Starting extension script `"{0}`" with Arguments {1} -TerminateExcel -Debug at {2}" -f $localDBscript, $registration, $stopwatch.Elapsed )
. "$localDBscript" -Registration $registration -TerminateExcel -Debug
} else {
Write-Host ( "Starting extension script `"{0}`" with Arguments {1} -Debug at {2}" -f $localDBscript, $registration, $stopwatch.Elapsed )
. "$localDBscript" -Registration $registration -Debug
}
Write-Host ( "Finished at {0} (time elapsed {1})" -f ( Get-Date ), $Stopwatch.Elapsed )
$Stopwatch.Stop( )
Write-Host ( "Registration = {0}" -f $registration )
Write-Host ( "Manufacturer = {0}" -f $Manufacturer )
Write-Host ( "Model = {0}" -f $Model )
} else {
if ( ( Get-Content "$localDBscript" ) -match 'TerminateExcel' ) {
. "$localDBscript" -Registration $registration -TerminateExcel
} else {
. "$localDBscript" -Registration $registration
}
}
if ( $Model ) {
if ( $Manufacturer ) {
$LabelHelptext.Text = ( "{0} {1}" -f $Manufacturer, $Model )
$searchquery = ( ( ( "{0} {1} {2}" -f $Manufacturer, $Model, $registration ) -replace " ","+" ) -replace ",","" )
} else {
$LabelHelptext.Text = $Model
$searchquery = ( ( ( "{0} {1}" -f $Model, $registration ) -replace " ","+" ) -replace ",","" )
}
$global:airportdatalink = ( $searchtemplate -f $searchquery )
$ButtonOpenLink.Enabled = $true
$ButtonOpenLink.Text = ( 'Search on {0}' -f $SearchEngine )
$ButtonOpenLink.Visible = $true
[System.Windows.Forms.Application]::DoEvents( ) # start updating GUI
Start-Sleep -Seconds 1 # allow GUI update to complete
$found = $true
$global:notfound = $false
} else {
if ( Test-Path -Path "$PSScriptRoot\$prefix" -PathType 'Container' ) {
$local = 'local'
} else {
$local = 'online'
}
$message = ( "$message, and not found in {0} {1} database either" -f $local, $prefix )
$LabelHelptext.Text = $message
[System.Windows.Forms.Application]::DoEvents( ) # start updating GUI
Start-Sleep -Seconds 1 # allow GUI update to complete
Search-OpenSky $message
}
} else {
$message = ( "$message, no local {0} database found" -f $prefix )
$LabelHelptext.Text = $message
[System.Windows.Forms.Application]::DoEvents( ) # start updating GUI
Start-Sleep -Seconds 1 # allow GUI update to complete
Search-OpenSky $message
}
$found
}
function Search-OpenSky( $message = 'Not found' ) {
[OutputType([bool])]
$registration = $TextboxReg.Text
$found = $false
$openskyscript = ( Join-Path $PSScriptRoot 'AirRegOpenSkyCmd.ps1' )
if ( Test-Path -Path $openskyscript -PathType 'Leaf' ) {
$LabelHelptext.Text = ( "{0}, searching OpenSky database, this may take a minute..." -f $LabelHelptext.Text )
[System.Windows.Forms.Application]::DoEvents( ) # start updating GUI
Start-Sleep -Seconds 1 # allow GUI update to complete
if ( $Debug ) {
Write-Host ( "Found OpenSky extension `"{0}`"" -f $openskyscript )
. "$openskyscript" -Registration $registration -NoBreak -Debug
} else {
. "$openskyscript" -Registration $registration -NoBreak
}
if ( $Model ) {
if ( $Manufacturer ) {
$LabelHelptext.Text = ( ( "{0} {1}" -f $Manufacturer, $Model ) -replace "`"","" )
$searchquery = ( ( ( ( "{0} {1} {2}" -f $Manufacturer, $Model, $registration ) -replace " ","+" ) -replace ",","" ) -replace "`"","" )
} else {
$LabelHelptext.Text = $Model
$searchquery = ( ( ( ( "{0} {1}" -f $Model, $registration ) -replace " ","+" ) -replace ",","" ) -replace "`"","" )
}
$global:airportdatalink = ( $searchtemplate -f $searchquery )
$ButtonOpenLink.Enabled = $true
$ButtonOpenLink.Text = ( 'Search on {0}' -f $SearchEngine )
$ButtonOpenLink.Visible = $true
$found = $true
$global:notfound = $false
} else {
$LabelHelptext.Text = "$message, nor in OpenSky database"
}
} else {
$LabelHelptext.Text = $message
}
$global:notfound
}
function Search-Aircraft( ) {
$url = ( 'http://www.airport-data.com/api/ac_thumb.json?r={0}' -f $TextboxReg.Text )
$ProgressPreference = 'SilentlyContinue'
$json = ( Invoke-WebRequest -Uri $url -TimeoutSec 10 ).Content | ConvertFrom-Json -ErrorAction Stop
$ProgressPreference = 'Continue'
if ( $json.status -eq 200 ) {
$LabelHelptext.Visible = $false
$PictureboxThumbnail.ImageLocation = $json.data.image
$LabelPhotographer.Visible = $true
$LabelPhotographer.Text = ( "Photographer: {0}" -f $json.data.photographer )
$ButtonOpenLink.Enabled = $true
$global:airportdatalink = $json.data.link
$PictureboxThumbnail.Visible = $true
$ButtonOpenLink.Visible = $true
$aircraftdescription = ( ( Invoke-WebRequest -Uri $global:airportdatalink ).Content | Select-String -Pattern ( '{0},[^\",]+' -f $TextboxReg.Text ) )
if ( $aircraftdescription.Matches.Count -gt 0 ) {
$aircrafttype = $aircraftdescription.Matches[0].Value
$aircrafttype = $aircrafttype -replace ( "^{0}, " -f $TextboxReg.Text ), ''
$aircrafttype = $aircrafttype -replace "^[12][0-9][0-9][0-9] ", ''
$aircrafttype = $aircrafttype -replace " C/N.+$", ''
$LabelAircraftType.Visible = $true
$LabelAircraftType.Text = $aircrafttype
}
} else {
$ButtonOpenLink.Visible = $false
$LabelPhotographer.Visible = $false
$PictureboxThumbnail.Visible = $false
$ButtonOpenLink.Enabled = $false
if ( Search-LocalDB( ( 'Status {0}, error {1} (aircraft registration not found on Airport-Data.com)' -f $json.status, $json.error ) ) ) {
if ( $global:notfound ) {
[console]::Beep( 500, 500 ) # beep if registration not found
}
}
$LabelHelptext.Visible = $true
}
}
function Validate-Input( $key = $null ) {
if ( $key -eq 'Return' ) {
Search-Aircraft
} else {
$cursorpos = $TextboxReg.SelectionStart + $TextboxReg.SelectionLength
$inputtext = $TextboxReg.Text.ToUpper( )
$inputtext = $inputtext -replace "[^A-Z\d\-]",""
if ( $inputtext -cne $TextboxReg.Text ) {
if ( $inputtext -cne $TextboxReg.Text.ToUpper( ) ) {
[console]::Beep( 500, 500 ) # beep in case of invalid character
}
$TextboxReg.Text = $inputtext
$TextboxReg.SelectionStart = [Math]::Min( $cursorpos, $inputtext.Length )
$TextboxReg.SelectionLength = 0
}
if ( ( $inputtext -replace "-","" ).Length -ge 4 ) {
$ButtonSearch.Enabled = $true
} else {
$ButtonSearch.Enabled = $false
}
$LabelHelptext.Visible = $true
$LabelHelptext.Text = $defaulthelptext
$LabelAircraftType.Text = ''
$LabelAircraftType.Visible = $false
$LabelPhotographer.Text = ''
$LabelPhotographer.Visible = $false
$PictureboxThumbnail.Visible = $false
$ButtonOpenLink.Text = 'View photo on Airport-data.com'
$ButtonOpenLink.Enabled = $false
$ButtonOpenLink.Visible = $false
}
}
############################################
# GUI form design was saved separately by #
# Visual Studio/Ironman Software's #
# PowerShell Pro Tools Suite as #
# AirRegGUI.designer.ps1 and then manually #
# embedded in AirRegGUI.ps1 by yours truly #
# #
# Start of embedded AirRegGUI.designer.ps1 #
############################################
[void][System.Reflection.Assembly]::Load( 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' )
[void][System.Reflection.Assembly]::Load( 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' )
$AirRegGUI = New-Object -TypeName System.Windows.Forms.Form
[System.Windows.Forms.TextBox]$TextboxReg = ( New-Object -TypeName System.Windows.Forms.TextBox )
[System.Windows.Forms.Button]$ButtonSearch = ( New-Object -TypeName System.Windows.Forms.Button )
[System.Windows.Forms.Button]$ButtonHelp = ( New-Object -TypeName System.Windows.Forms.Button )
[System.Windows.Forms.Button]$ButtonOpenLink = ( New-Object -TypeName System.Windows.Forms.Button )
[System.Windows.Forms.PictureBox]$PictureboxThumbnail = ( New-Object -TypeName System.Windows.Forms.PictureBox )
[System.Windows.Forms.Label]$LabelHelptext = ( New-Object -TypeName System.Windows.Forms.Label )
[System.Windows.Forms.Label]$LabelAircraftType = ( New-Object -TypeName System.Windows.Forms.Label )
[System.Windows.Forms.Label]$LabelPhotographer = ( New-Object -TypeName System.Windows.Forms.Label )
( [System.ComponentModel.ISupportInitialize]$PictureboxThumbnail ).BeginInit( )
$AirRegGUI.SuspendLayout( )
$TextboxReg.Location = (New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]37, [System.Int32]41 ) )
$TextboxReg.MaxLength = [System.Int32]8
$TextboxReg.Name = [System.String]'TextboxReg'
$TextboxReg.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]100, [System.Int32]26 ) )
$TextboxReg.TabIndex = [System.Int32]0
$TextboxReg.Add_TextChanged( $TextboxReg_TextChanged )
$TextboxReg.Add_KeyUp( $TextboxReg_KeyUp )
$ButtonSearch.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]159, [System.Int32]40 ) )
$ButtonSearch.Name = [System.String]'ButtonSearch'
$ButtonSearch.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]75, [System.Int32]28 ) )
$ButtonSearch.TabIndex = [System.Int32]1
$ButtonSearch.Text = [System.String]'Search'
$ButtonSearch.UseVisualStyleBackColor = $true
$ButtonSearch.Add_Click( $ButtonSearch_Click )
$ButtonSearch.Enabled = $false
$ButtonHelp.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]256, [System.Int32]40 ) )
$ButtonHelp.Name = [System.String]'ButtonHelp'
$ButtonHelp.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]75, [System.Int32]28 ) )
$ButtonHelp.TabIndex = [System.Int32]2
$ButtonHelp.Text = [System.String]'Help'
$ButtonHelp.UseVisualStyleBackColor = $true
$ButtonHelp.Add_Click( $ButtonHelp_Click )
$ButtonOpenLink.Enabled = $false
#$ButtonOpenLink.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]37, [System.Int32]315 ) )
$ButtonOpenLink.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]37, [System.Int32]355 ) )
$ButtonOpenLink.Name = [System.String]'ButtonOpenLink'
$ButtonOpenLink.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]294, [System.Int32]28 ) )
$ButtonOpenLink.TabIndex = [System.Int32]4
$ButtonOpenLink.Text = [System.String]'View photo on Airport-data.com'
$ButtonOpenLink.UseVisualStyleBackColor = $true
$ButtonOpenLink.Add_Click( $ButtonOpenLink_Click )
$ButtonOpenLink.Visible = $false
$PictureboxThumbnail.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]82, [System.Int32]101 ) )
$PictureboxThumbnail.Name = [System.String]'PictureboxThumbnail'
$PictureboxThumbnail.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]200, [System.Int32]150 ) )
$PictureboxThumbnail.TabIndex = [System.Int32]3
$PictureboxThumbnail.TabStop = $false
$PictureboxThumbnail.Visible = $false
$LabelHelptext.AutoSize = $true
$LabelHelptext.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]37, [System.Int32]101 ) )
$LabelHelptext.MaximumSize = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]294, [System.Int32]0 ) )
$LabelHelptext.Name = [System.String]'LabelHelptext'
$LabelHelptext.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]275, [System.Int32]60 ) )
$LabelHelptext.TabIndex = [System.Int32]6
$LabelHelptext.Text = [System.String]''
$LabelAircraftType.AutoSize = $true
#$LabelAircraftType.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]33, [System.Int32]273 ) )
$LabelAircraftType.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]33, [System.Int32]273 ) )
$LabelAircraftType.Name = [System.String]'$LabelAircraftType'
$LabelAircraftType.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]110, [System.Int32]20 ) )
$LabelAircraftType.TabIndex = [System.Int32]5
$LabelAircraftType.Text = [System.String]'Photographer:'
$LabelAircraftType.Visible = $false
$LabelPhotographer.AutoSize = $true
#$LabelPhotographer.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]33, [System.Int32]273 ) )
$LabelPhotographer.Location = ( New-Object -TypeName System.Drawing.Point -ArgumentList @( [System.Int32]33, [System.Int32]315 ) )
$LabelPhotographer.Name = [System.String]'LabelPhotographer'
$LabelPhotographer.Size = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]110, [System.Int32]20 ) )
$LabelPhotographer.TabIndex = [System.Int32]5
$LabelPhotographer.Text = [System.String]'Photographer:'
$LabelPhotographer.Visible = $false
# Icon embedding code by Theo on https://stackoverflow.com/a/53377253
# Airplane icon image courtesy of https://icons8.com/
$iconBase64 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABY0lEQVR42mNkGGDAiEduIhDbAfFfIE4F4vP0doA5EB+HqnkO5T+mpwNAYD0QB0DZV4HYCog/0dMBmkB8BYiZoPw9QOwFxL/p5QAQmA/ECUj8BUCcSE8HyAHxbSBmQxKrB+ImejkABCYAcT4S/z80VBZRwwEgg/cyQOIaFxAF4ntAzIMk9guIPYF4H6UOeMgAyetGQPwBj9oGBkjQI4OPDJCccY0SB2wHYg8GSJYLwqOWFxoKImjiIA9YAPELch3QC8RFUH4BA6QExAUKgbgPi/g5ILYF4m/kOACUpeZB+aB4tQHi0zjUcwDxTQZIzkAHW4HYD4j/keoAUBF7AknsAQMkr+MCzlDfYgOgaLxIhL2gNHcKiHeBHACKW6oWrySAOlg5AEpIcpSYRCb4MigcMOBRMOCJcMCz4YAXRANeFA94ZTTg1TExgKYNEkJgwJtkA9ooHfBm+YB2TAa8azbgnVO6AAAjEXEBu6DybwAAAABJRU5ErkJggg=='
$iconBytes = [Convert]::FromBase64String( $iconBase64 )
$stream = New-Object IO.MemoryStream( $iconBytes, 0, $iconBytes.Length )
$stream.Write( $iconBytes, 0, $iconBytes.Length );
$iconImage = [System.Drawing.Image]::FromStream( $stream, $true )
$AirRegGUI.ClientSize = ( New-Object -TypeName System.Drawing.Size -ArgumentList @( [System.Int32]384, [System.Int32]441 ) )
$AirRegGUI.Controls.Add( $LabelHelptext )
$AirRegGUI.Controls.Add( $LabelAircraftType )
$AirRegGUI.Controls.Add( $LabelPhotographer )
$AirRegGUI.Controls.Add( $ButtonOpenLink )
$AirRegGUI.Controls.Add( $PictureboxThumbnail )
$AirRegGUI.Controls.Add( $ButtonHelp )
$AirRegGUI.Controls.Add( $ButtonSearch )
$AirRegGUI.Controls.Add( $TextboxReg )
$AirRegGUI.Font = ( New-Object -TypeName System.Drawing.Font -ArgumentList @( [System.String]'Microsoft Sans Serif', [System.Single]12, [System.Drawing.FontStyle]::Regular, [System.Drawing.GraphicsUnit]::Point, ( [System.Byte][System.Byte]0) ) )
$AirRegGUI.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$AirRegGUI.MaximizeBox = $false
$AirRegGUI.Name = [System.String]'AirRegGUI'
$AirRegGUI.SizeGripStyle = [System.Windows.Forms.SizeGripStyle]::Hide
$AirRegGUI.StartPosition = 'CenterScreen'
$AirRegGUI.Icon = [System.Drawing.Icon]::FromHandle( ( New-Object System.Drawing.Bitmap -Argument $stream ).GetHIcon( ) ) # Icon embedding code by Theo on https://stackoverflow.com/a/53377253
$AirRegGUI.Text = [System.String]'AirRegGUI.ps1'
$AirRegGUI.Add_Load( $Window_Load )
$AirRegGUI.Add_Shown( $Window_Shown )
$AirRegGUI.Add_HelpRequested( $ButtonHelp_Click )
( [System.ComponentModel.ISupportInitialize]$PictureboxThumbnail ).EndInit( )
$AirRegGUI.ResumeLayout( $false )
$AirRegGUI.PerformLayout( )
Add-Member -InputObject $AirRegGUI -Name base -Value $base -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name TextboxReg -Value $TextboxReg -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name ButtonSearch -Value $ButtonSearch -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name ButtonHelp -Value $ButtonHelp -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name PictureboxThumbnail -Value $PictureboxThumbnail -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name ButtonOpenLink -Value $ButtonOpenLink -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name LabelHelptext -Value $LabelHelptext -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name LabelAircraftType -Value $LabelAircraftType -MemberType NoteProperty
Add-Member -InputObject $AirRegGUI -Name LabelPhotographer -Value $LabelPhotographer -MemberType NoteProperty
##########################################
# End of embedded AirRegGUI.designer.ps1 #
##########################################
# Check for program updates and notify user if available
Check-Update
# Open GUI window
[void] $AirRegGUI.ShowDialog( )
# Clean up (ShowDialog does not always clean up by itself)
[void] $AirRegGUI.Dispose( )
page last modified: 2024-04-16; loaded in 0.0312 seconds