diff --git a/winutil.ps1 b/winutil.ps1 index 0ea7c47e..92d7e8df 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -253,15 +253,16 @@ $inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace [xml]$XAML = $inputXML #Read XAML - $reader=(New-Object System.Xml.XmlNodeReader $xaml) - try{$Form=[Windows.Markup.XamlReader]::Load( $reader )} +$reader=(New-Object System.Xml.XmlNodeReader $xaml) +try{$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"} + 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 😀 +catch{# If it broke some other way 😀 Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." } @@ -272,7 +273,7 @@ catch{#if it broke some other way