From 54762d9a27a1d4838ff987f848a2dbca1a78b043 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Mon, 23 Sep 2024 12:46:49 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"refac(invoke-wpfuninstall.ps1):=20rem?= =?UTF-8?q?ove=20null=20assignments=20and=20simplify=20=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f516c09ab3b763ee28f474f58d5514aae582f3bf. --- functions/public/Invoke-WPFUnInstall.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/functions/public/Invoke-WPFUnInstall.ps1 b/functions/public/Invoke-WPFUnInstall.ps1 index 54eaad7ead..7180ecf20e 100644 --- a/functions/public/Invoke-WPFUnInstall.ps1 +++ b/functions/public/Invoke-WPFUnInstall.ps1 @@ -32,10 +32,11 @@ function Invoke-WPFUnInstall { Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock { param($PackagesToInstall, $ChocoPreference, $DebugPreference) - - $taskbarItemState = if ($PackagesToInstall.Count -eq 1) { "Indeterminate" } else { "Normal" } - $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state $taskbarItemState -value 0.01 -overlay "logo" }) - + if ($PackagesToInstall.count -eq 1) { + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) + } else { + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }) + } $packagesWinget, $packagesChoco = { $packagesWinget = [System.Collections.ArrayList]::new() $packagesChoco = [System.Collections.ArrayList]::new() @@ -46,7 +47,7 @@ function Invoke-WPFUnInstall { $packagesWinget.add($package.winget) Write-Host "Queueing $($package.winget) for Winget uninstall" } else { - $packagesChoco.add($package.choco) + $null = $packagesChoco.add($package.choco) Write-Host "Queueing $($package.choco) for Chocolatey uninstall" } } @@ -55,7 +56,7 @@ function Invoke-WPFUnInstall { $packagesChoco.add($package.choco) Write-Host "Queueing $($package.choco) for Chocolatey uninstall" } else { - $packagesWinget.add($($package.winget)) + $null = $packagesWinget.add($($package.winget)) Write-Host "Queueing $($package.winget) for Winget uninstall" } }