fix scrollviewer & reimplement logo logic into ui elements

This commit is contained in:
MyDrift
2024-09-28 02:01:53 +02:00
parent 4c38768b32
commit 5bb940d4d5
3 changed files with 36 additions and 34 deletions

View File

@ -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