diff --git a/functions/public/Invoke-WPFUpdateMGMGT.ps1 b/functions/public/Invoke-WPFUpdateMGMGT.ps1 index d6cec270..8ec56047 100644 --- a/functions/public/Invoke-WPFUpdateMGMGT.ps1 +++ b/functions/public/Invoke-WPFUpdateMGMGT.ps1 @@ -4,6 +4,8 @@ function Invoke-WPFUpdateMGMT { [switch]$All ) + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) + if ($All) { Write-Host "Installing all available updates ..." Invoke-WPFRunspace -ArgumentList $sync["WPFUpdateVerbose"].IsChecked -DebugPreference $DebugPreference -ScriptBlock { @@ -13,7 +15,9 @@ function Invoke-WPFUpdateMGMT { } else { Install-WindowsUpdate -Confirm:$false -IgnoreReboot:$true -IgnoreRebootRequired:$true } + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) Write-Host "All Update Processes Completed" + #catch $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } } elseif (($Selected) -and ($sync["WPFUpdatesList"].SelectedItems.Count -gt 0)) { write-host "Installing selected updates..." @@ -35,11 +39,12 @@ function Invoke-WPFUpdateMGMT { Get-WindowsUpdate -ComputerName $update.ComputerName -Title $update.Title -Install -Confirm:$false -IgnoreReboot:$true -IgnoreRebootRequired:$true } } + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) Write-Host "Selected Update Processes Completed" + #catch $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } } else { Write-Host "No updates selected" return } - } diff --git a/functions/public/Invoke-WPFUpdateScanHistory.ps1 b/functions/public/Invoke-WPFUpdateScanHistory.ps1 index 4138e746..8c8dcdb5 100644 --- a/functions/public/Invoke-WPFUpdateScanHistory.ps1 +++ b/functions/public/Invoke-WPFUpdateScanHistory.ps1 @@ -1,4 +1,5 @@ function Invoke-WPFUpdateScanHistory { + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync["WPFUpdateHistory"].Items.Clear() Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock { write-host "Scanning for Windows update history..." @@ -35,6 +36,8 @@ function Invoke-WPFUpdateScanHistory { $sync["WPFUpdateHistory"].Columns[0].Visibility = "Collapsed" } }) + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) + #catch $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } else { $sync.form.Dispatcher.Invoke([action] { diff --git a/functions/public/Invoke-WPFUpdatesScan.ps1 b/functions/public/Invoke-WPFUpdatesScan.ps1 index 4805b022..816b0cec 100644 --- a/functions/public/Invoke-WPFUpdatesScan.ps1 +++ b/functions/public/Invoke-WPFUpdatesScan.ps1 @@ -2,6 +2,7 @@ function Invoke-WPFUpdatesScan { Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock { + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) # Check if the PSWindowsUpdate module is installed if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) { try { @@ -51,8 +52,10 @@ function Invoke-WPFUpdatesScan { $sync["WPFUpdatesList"].Columns[0].Visibility = "Collapsed" } }) + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }) } catch { Write-Error "Error scanning for updates: $_" + $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -overlay "warning" }) } } }