performance improvement

instead of rendering the image another time on each item switch, it caches it at the start and uses the render afterwards
This commit is contained in:
MyDrift 2024-09-03 21:53:31 +02:00
parent 4b741ce430
commit 5885c067e0
2 changed files with 7 additions and 3 deletions

View File

@ -61,13 +61,13 @@ function Set-WinUtilTaskbaritem {
if ($overlay) { if ($overlay) {
switch ($overlay) { switch ($overlay) {
'logo' { 'logo' {
$sync["Form"].taskbarItemInfo.Overlay = (Invoke-WinUtilAssets -Type "Logo" -Size 80 -Render) $sync["Form"].taskbarItemInfo.Overlay = $sync["logorender"]
} }
'checkmark' { 'checkmark' {
$sync["Form"].taskbarItemInfo.Overlay = (Invoke-WinUtilAssets -Type "checkmark" -Size 512 -Render) $sync["Form"].taskbarItemInfo.Overlay = $sync["checkmarkrender"]
} }
'warning' { 'warning' {
$sync["Form"].taskbarItemInfo.Overlay = (Invoke-WinUtilAssets -Type "warning" -Size 512 -Render) $sync["Form"].taskbarItemInfo.Overlay = $sync["warningrender"]
} }
'None' { 'None' {
$sync["Form"].taskbarItemInfo.Overlay = $null $sync["Form"].taskbarItemInfo.Overlay = $null

View File

@ -457,6 +457,10 @@ $winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico" $winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
$sync["logorender"] = (Invoke-WinUtilAssets -Type "Logo" -Size 90 -Render)
$sync["checkmarkrender"] = (Invoke-WinUtilAssets -Type "checkmark" -Size 512 -Render)
$sync["warningrender"] = (Invoke-WinUtilAssets -Type "warning" -Size 512 -Render)
Set-WinUtilTaskbaritem -overlay "logo" Set-WinUtilTaskbaritem -overlay "logo"
$sync["Form"].Add_Activated({ $sync["Form"].Add_Activated({