diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index c27a0487..ef72507a 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -169,28 +169,7 @@ function Invoke-WPFUIElements { $image.Width = 40 $image.Height = 40 $image.Margin = New-Object Windows.Thickness(0, 0, 10, 0) - if (-not [string]::IsNullOrEmpty($kaka)) { - try { - $packageinfo = (choco info $entryInfo.choco --limit-output).Split(' ')[0] - $packageinfo = $packageinfo -replace '\|', '.' - $iconlink = "https://community.chocolatey.org/content/packageimages/" + $packageinfo - $finishediconlink = $iconlink + ".png" - - $webimage = Invoke-WebRequest -Uri $finishediconlink -Method Head -ErrorAction SilentlyContinue - - if ($webimage.StatusCode -eq 200) { - $image.Source = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($finishediconlink)) - } else { - $finishediconlink = $iconlink + ".svg" - $image.Source = $noimage - } - - } catch { - $image.Source = $noimage - } - } else { - $image.Source = $noimage - } + $image.Source = $noimage $image.Clip = New-Object Windows.Media.RectangleGeometry $image.Clip.Rect = New-Object Windows.Rect(0, 0, $image.Width, $image.Height) $image.Clip.RadiusX = 5 diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 5e0df64a..e122454c 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -219,6 +219,27 @@ Invoke-WPFUIElements -configVariable $finalConfigObject -targetGridName "appscat Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2 Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2 +$chocoapps = $sync.configs.applications.PSObject.Properties.Value | Where-Object { $_.Choco } | Select-Object + +$chocologos = Invoke-WPFRunspace -Argumentlist $chocoapps -DebugPreference $DebugPreference -ScriptBlock { + param ($chocoapps) + try { + foreach ($entry in $chocoapps) { + $packageinfo = (choco info $entry.choco --limit-output).Split(' ')[0] + $packageinfo = $packageinfo -replace '\|', '.' + $iconlink = "https://community.chocolatey.org/content/packageimages/" + $packageinfo + $webimage = $iconlink + ".png" + + $webimage = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($webimage)) + $result = @{} + $result[$entry.Name] = $webimage + } + } catch { + # do nothing + } + return $result +} + #=========================================================================== # Store Form Objects In PowerShell #=========================================================================== diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 67b681a3..a24ba93b 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -927,6 +927,9 @@