mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 00:54:47 -05:00
[Fixes] Improve Error Handling + UI (#3437)
* add proper error handling + Taskbaritem support to WPFSystemRepair * implement other fixes - add Taskbarprogress to WPFFixesNetwork - add Taskbarprogress to WPFFixesUpdate - add Error handling + Taskbarprogress to WPFFixesWinget - add finalisation in WPFSystemRepair
This commit is contained in:
@ -30,6 +30,8 @@ function Invoke-WPFFixesUpdate {
|
||||
param($Aggressive = $false)
|
||||
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -PercentComplete 0
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
|
||||
Write-Host "Starting Windows Update Repair..."
|
||||
# Wait for the first progress bar to show, otherwise the second one won't show
|
||||
Start-Sleep -Milliseconds 200
|
||||
|
||||
@ -190,12 +192,15 @@ function Invoke-WPFFixesUpdate {
|
||||
try {
|
||||
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
|
||||
} catch {
|
||||
Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
|
||||
Write-Warning "Failed to create Windows Update COM object: $_"
|
||||
}
|
||||
Start-Process -NoNewWindow -FilePath "wuauclt" -ArgumentList "/resetauthorization", "/detectnow"
|
||||
Write-Progress -Id 10 -ParentId 0 -Activity "Forcing discovery" -Status "Completed" -PercentComplete 100
|
||||
Write-Progress -Id 0 -Activity "Repairing Windows Update" -Status "Completed" -PercentComplete 100
|
||||
|
||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||
|
||||
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||||
$MessageboxTitle = "Reset Windows Update "
|
||||
$Messageboxbody = ("Stock settings loaded.`n Please reboot your computer")
|
||||
|
Reference in New Issue
Block a user