From 5bb940d4d5b7ad5ff92f98eaa52633bb6f0d6958 Mon Sep 17 00:00:00 2001 From: MyDrift Date: Sat, 28 Sep 2024 02:01:53 +0200 Subject: [PATCH] fix scrollviewer & reimplement logo logic into ui elements --- functions/public/Invoke-WPFUIElements.ps1 | 24 ++++++++++++++++++++-- scripts/main.ps1 | 21 ------------------- xaml/inputXML.xaml | 25 +++++++++++++---------- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index be941a2b..dc609170 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -137,7 +137,7 @@ function Invoke-WPFUIElements { if ($configVariable -eq $sync.configs.applications) { # Create the outer Border for the application type $border = New-Object Windows.Controls.Border - $border.Name = $entryInfo.Name + $border.Name = "wpfappborder" + $entryInfo.Name $border.BorderBrush = [Windows.Media.Brushes]::Gray $border.BorderThickness = 1 $border.CornerRadius = 5 @@ -167,10 +167,30 @@ function Invoke-WPFUIElements { # Create the Image and load it from the local path $image = New-Object Windows.Controls.Image + $image.Name = "wpfapplogo" + $entryInfo.Name $image.Width = 40 $image.Height = 40 $image.Margin = New-Object Windows.Thickness(0, 0, 10, 0) - $image.Source = $noimage + 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 e122454c..5e0df64a 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -219,27 +219,6 @@ 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 a24ba93b..cba779f1 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -932,18 +932,21 @@ - - - - - - - - - - + + + + + + + + - + + + + + +