Revert "refac(invoke-wpfuninstall.ps1): remove null assignments and simplify …" (#2806)

This reverts commit f516c09ab3.
This commit is contained in:
Chris Titus 2024-09-23 12:49:01 -05:00 committed by GitHub
parent f516c09ab3
commit fd2ac35228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,10 +32,11 @@ function Invoke-WPFUnInstall {
Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToInstall, $ChocoPreference, $DebugPreference) param($PackagesToInstall, $ChocoPreference, $DebugPreference)
if ($PackagesToInstall.count -eq 1) {
$taskbarItemState = if ($PackagesToInstall.Count -eq 1) { "Indeterminate" } else { "Normal" } $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state $taskbarItemState -value 0.01 -overlay "logo" }) } else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
}
$packagesWinget, $packagesChoco = { $packagesWinget, $packagesChoco = {
$packagesWinget = [System.Collections.ArrayList]::new() $packagesWinget = [System.Collections.ArrayList]::new()
$packagesChoco = [System.Collections.ArrayList]::new() $packagesChoco = [System.Collections.ArrayList]::new()
@ -46,7 +47,7 @@ function Invoke-WPFUnInstall {
$packagesWinget.add($package.winget) $packagesWinget.add($package.winget)
Write-Host "Queueing $($package.winget) for Winget uninstall" Write-Host "Queueing $($package.winget) for Winget uninstall"
} else { } else {
$packagesChoco.add($package.choco) $null = $packagesChoco.add($package.choco)
Write-Host "Queueing $($package.choco) for Chocolatey uninstall" Write-Host "Queueing $($package.choco) for Chocolatey uninstall"
} }
} }
@ -55,7 +56,7 @@ function Invoke-WPFUnInstall {
$packagesChoco.add($package.choco) $packagesChoco.add($package.choco)
Write-Host "Queueing $($package.choco) for Chocolatey uninstall" Write-Host "Queueing $($package.choco) for Chocolatey uninstall"
} else { } else {
$packagesWinget.add($($package.winget)) $null = $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget uninstall" Write-Host "Queueing $($package.winget) for Winget uninstall"
} }
} }