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

@ -20,10 +20,10 @@ function Invoke-WPFInstall {
return
}
$sync["Form"].taskbarItemInfo.ProgressState = "Normal"
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToInstall, $DebugPreference)
Set-WinUtilTaskbaritem -state "Normal" -value 1/$PackagesToInstall.Count
$packagesWinget, $packagesChoco = {
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
@ -54,13 +54,13 @@ function Invoke-WPFInstall {
Write-Host "==========================================="
Write-Host "-- Installs have finished ---"
Write-Host "==========================================="
# $sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
# Set-WinUtilTaskbaritem -state "None"
}
Catch {
Write-Host "==========================================="
Write-Host "Error: $_"
Write-Host "==========================================="
# $sync["Form"].taskbarItemInfo.ProgressState = "Error"
# Set-WinUtilTaskbaritem -state "Error"
}
Start-Sleep -Seconds 5
$sync.ProcessRunning = $False