mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-04-01 17:12:09 +00:00
Add Taskbaritem indication
This commit is contained in:
parent
a9675fc91b
commit
8fabebedf4
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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] {
|
||||
|
@ -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" })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user