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) { if ($configVariable -eq $sync.configs.applications) {
# Create the outer Border for the application type # Create the outer Border for the application type
$border = New-Object Windows.Controls.Border $border = New-Object Windows.Controls.Border
$border.Name = $entryInfo.Name $border.Name = "wpfappborder" + $entryInfo.Name
$border.BorderBrush = [Windows.Media.Brushes]::Gray $border.BorderBrush = [Windows.Media.Brushes]::Gray
$border.BorderThickness = 1 $border.BorderThickness = 1
$border.CornerRadius = 5 $border.CornerRadius = 5
@ -167,10 +167,30 @@ function Invoke-WPFUIElements {
# Create the Image and load it from the local path # Create the Image and load it from the local path
$image = New-Object Windows.Controls.Image $image = New-Object Windows.Controls.Image
$image.Name = "wpfapplogo" + $entryInfo.Name
$image.Width = 40 $image.Width = 40
$image.Height = 40 $image.Height = 40
$image.Margin = New-Object Windows.Thickness(0, 0, 10, 0) $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 = New-Object Windows.Media.RectangleGeometry
$image.Clip.Rect = New-Object Windows.Rect(0, 0, $image.Width, $image.Height) $image.Clip.Rect = New-Object Windows.Rect(0, 0, $image.Width, $image.Height)
$image.Clip.RadiusX = 5 $image.Clip.RadiusX = 5

View File

@ -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.tweaks -targetGridName "tweakspanel" -columncount 2
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -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 # Store Form Objects In PowerShell
#=========================================================================== #===========================================================================

View File

@ -932,18 +932,21 @@
</CheckBox> </CheckBox>
</StackPanel> </StackPanel>
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Margin="{DynamicResource TabContentMargin}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid> <Grid Grid.Row="1" Grid.Column="0" Margin="{DynamicResource TabContentMargin}">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" /> <ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" /> <ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid Name="appscategory" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
</Grid> <Grid Name="appscategory" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="appspanel" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
</Grid>
</Grid> </Grid>
</ScrollViewer>
<ScrollViewer x:Name="scrollViewer" Grid.Column="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="appspanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
</Grid>
</ScrollViewer>
</Grid>
<Rectangle Grid.Row="1" Grid.Column="0" Width="22" Height="22" Fill="{DynamicResource MainBackgroundColor}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ScrollVisibilityRectangle}"/> <Rectangle Grid.Row="1" Grid.Column="0" Width="22" Height="22" Fill="{DynamicResource MainBackgroundColor}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ScrollVisibilityRectangle}"/>