mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-24 03:45:30 +00:00
performance improvements
- move get logo to runspace (not working rn) - readd choco checkbox to mute errors
This commit is contained in:
parent
71c35eccd6
commit
6229ab6dd4
@ -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
|
||||
|
@ -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
|
||||
#===========================================================================
|
||||
|
@ -927,6 +927,9 @@
|
||||
<Button Name="WPFUninstall" Content=" Uninstall Selected" Margin="2"/>
|
||||
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>
|
||||
<Button Name="WPFClearInstallSelection" Content=" Clear Selection" Margin="2"/>
|
||||
<CheckBox Name="WPFpreferChocolatey" VerticalAlignment="Center" VerticalContentAlignment="Center">
|
||||
<TextBlock Text="Prefer Chocolatey" ToolTip="Prefers Chocolatey as Download Engine instead of Winget" VerticalAlignment="Center" />
|
||||
</CheckBox>
|
||||
</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">
|
||||
|
Loading…
Reference in New Issue
Block a user