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

@ -10,8 +10,7 @@ function Invoke-WinUtilFeatureInstall {
$CheckBox
)
$sync["Form"].taskbarItemInfo.ProgressState = "Normal"
$sync["Form"].taskbarItemInfo.ProgressValue = 1 # Get amount of affected features & scripts
Set-WinUtilTaskbaritem -state "Normal" -value 1
$CheckBox | ForEach-Object {
if($sync.configs.feature.$psitem.feature){
@ -26,7 +25,7 @@ function Invoke-WinUtilFeatureInstall {
}
else{
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
Set-WinUtilTaskbaritem -state "Error"
Write-Warning "Unable to Install $feature due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
@ -47,7 +46,7 @@ function Invoke-WinUtilFeatureInstall {
}
else{
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
Set-WinUtilTaskbaritem -state "Error"
Write-Warning "Unable to Install $feature due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
@ -56,6 +55,6 @@ function Invoke-WinUtilFeatureInstall {
}
}
if ($sync["Form"].taskbarItemInfo.ProgressState -ne "Error"){
$sync["Form"].taskbarItemInfo.ProgressState = "None"
Set-WinUtilTaskbaritem -state "None"
}
}