Fix some logic issue in 'Set-WinUtilUITheme.ps1' Private Function - Rename 'Set-WinUtilUiTheme.ps1' -> 'Set-WinUtilUITheme.ps1'

This commit is contained in:
Mr.k
2024-08-26 17:06:57 +03:00
parent 49639ec2f7
commit 8ccde4fa59
3 changed files with 80 additions and 96 deletions

View File

@ -62,16 +62,15 @@ if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
$ctttheme = 'Classic'
}
$returnVal = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
if ($returnVal.err -eq $null) {
$inputXML = Set-WinUtilUITheme -inputXML $inputXML -customThemeName $ctttheme
if ($inputXML -eq "") {
Write-Warning "Failed to statically apply theming to xaml content using Set-WinUtilTheme, please check previous Error/Warning messages."
Write-Warning "Quitting winutil..."
$sync.runspace.Dispose()
$sync.runspace.Close()
[System.GC]::Collect()
return
exit 1
}
$inputXML = $returnVal.processedXML
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = $inputXML
@ -94,11 +93,12 @@ try {
}
if (-NOT ($readerOperationSuccessful)) {
Write-Warning "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method, quitting winutil..."
Write-Warning "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method."
Write-Warning "Quitting winutil..."
$sync.runspace.Dispose()
$sync.runspace.Close()
[System.GC]::Collect()
return
exit 1
}
#===========================================================================