From d0ddeb84f6d732268a21433b883e3e935efcc047 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Wed, 18 May 2022 07:14:26 -0500 Subject: [PATCH] formatting --- winutil-test.ps1 | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/winutil-test.ps1 b/winutil-test.ps1 index ab4e02e6..e93858a2 100644 --- a/winutil-test.ps1 +++ b/winutil-test.ps1 @@ -23,27 +23,25 @@ } else{ $inputXML = (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/MainWindow.xaml") - $global:sync["applications"] = invoke-restmethod "https://raw.githubusercontent.com/ChrisTitusTech/winutil/test/applications.json" + $global:sync["applications"] = Invoke-RestMethod "https://raw.githubusercontent.com/ChrisTitusTech/winutil/test/applications.json" } $inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^ - Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." - } + + try{$global:sync["Form"]=[Windows.Markup.XamlReader]::Load( $reader )} + catch [System.Management.Automation.MethodInvocationException] { + Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..." + write-host $error[0].Exception.Message -ForegroundColor Red + if ($error[0].Exception.Message -like "*button*"){ + write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"} + } + catch{#if it broke some other way 😀 + Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." + } + +#endregion Variables #=========================================================================== # Store Form Objects In PowerShell