add function to manage taskbar item

changed from manually setting the taskbar overlay, progressvalue and progress state to setting them through a function
This commit is contained in:
MyDrift
2024-07-12 08:00:32 +02:00
parent a86b07a826
commit 73973d7101
12 changed files with 99 additions and 57 deletions

View File

@ -13,20 +13,20 @@ function Install-WinUtilChoco {
if((Test-WinUtilPackageManager -choco) -eq "installed") {
return
}
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
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
$sync["Form"].taskbarItemInfo.ProgressState = "None"
Set-WinUtilTaskbaritem -state "None"
}
Catch {
Write-Host "===========================================" -Foregroundcolor Red
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
Write-Host "===========================================" -Foregroundcolor Red
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
Set-WinUtilTaskbaritem -state "Error"
}
}