From 32877fe200dbc2e08866a8a7e28e510444459518 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Wed, 28 Aug 2024 19:33:48 +0300 Subject: [PATCH 1/2] Re-order some logic in 'main.ps1' script --- scripts/main.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 5f93cd39a2..74bfd9f531 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -95,12 +95,6 @@ try { Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." } -# Load the configuration files -#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid" -Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5 -Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2 -Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2 - if (-NOT ($readerOperationSuccessful)) { Write-Host "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method." -ForegroundColor Red Write-Host "Quitting winutil..." -ForegroundColor Red @@ -110,6 +104,12 @@ if (-NOT ($readerOperationSuccessful)) { exit 1 } +# Load the configuration files +#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid" +Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5 +Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2 +Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2 + #=========================================================================== # Store Form Objects In PowerShell #=========================================================================== From 0c4c4835dfa9d8841f0e6c8a7aac40db1e1bee2c Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Wed, 28 Aug 2024 19:38:26 +0300 Subject: [PATCH 2/2] Use 'Write-Host' instead of 'Write-Warning' in 'main.ps1' script to make sure the output is seen in different environments This'll make sure that the output is displayed in PowerShell 5 developing environments, and when outputing Warnings/Errors in Runspaces. --- scripts/main.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 74bfd9f531..a18ed0b994 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -85,14 +85,14 @@ try { $sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader ) $readerOperationSuccessful = $true } catch [System.Management.Automation.MethodInvocationException] { - Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..." + Write-Host "We ran into a problem with the XAML code. Check the syntax for this control..." -ForegroundColor Red 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" + write-Host "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n" -ForegroundColor Red } } catch { - Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." + Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." -ForegroundColor Red } if (-NOT ($readerOperationSuccessful)) {