use Dispatcher.Invoke

This commit is contained in:
MyDrift
2024-07-13 12:54:59 +02:00
parent 790e0b22a5
commit 27792dc8a3
10 changed files with 23 additions and 20 deletions

View File

@ -14,19 +14,19 @@ function Install-WinUtilChoco {
return
}
Set-WinUtilTaskbaritem -state "Indeterminate"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
Write-Host "Seems Chocolatey is not installed, installing now."
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
powershell choco feature enable -n allowGlobalConfirmation
Set-WinUtilTaskbaritem -state "None"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
}
Catch {
Write-Host "===========================================" -Foregroundcolor Red
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
Write-Host "===========================================" -Foregroundcolor Red
Set-WinUtilTaskbaritem -state "Error"
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
}
}