Complete Winget Install Overhaul and Progress Bar in GUI (#2466)

* Compile Winutil

* first draft for Progress bar in GUI

* small optimizations to the loading bar

* Optimize the Winget Installation Function to make it more maintainable

* Apply loading bar to Tweaks

* Update colors

* Add docs

* Fix value range for the taskbar item

* Remove winutil.ps1 from PR

* Documention and fix an oversight in the uninstall logic

* Reduce even more repeaded code

---------

Co-authored-by: Marterich <Marterich@users.noreply.github.com>
This commit is contained in:
Martin Wiethan
2024-07-31 04:13:30 +02:00
committed by GitHub
parent 18f9f5e35d
commit e7328c2739
11 changed files with 276 additions and 305 deletions

View File

@ -29,14 +29,14 @@ function Invoke-WPFInstall {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
}
$packagesWinget, $packagesChoco = {
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
$packagesWinget = [System.Collections.ArrayList]::new()
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
foreach ($package in $PackagesToInstall) {
if ($package.winget -eq "na") {
$packagesChoco.add($package)
Write-Host "Queueing $($package.choco) for Chocolatey install"
} else {
$packagesWinget.add($package)
$null = $packagesWinget.add($($package.winget))
Write-Host "Queueing $($package.winget) for Winget install"
}
}
@ -48,7 +48,7 @@ function Invoke-WPFInstall {
$errorPackages = @()
if($packagesWinget.Count -gt 0){
Install-WinUtilWinget
$errorPackages += Install-WinUtilProgramWinget -ProgramsToInstall $packagesWinget
$errorPackages += Invoke-WinUtilWingetProgram -Action Install -Programs $packagesWinget
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
}
if($packagesChoco.Count -gt 0){