mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
Choco Logic Refactor and Add Checkbox to prefer Chocolatey over Winget (#2596)
* First Selector and Logic * Extend Functionality * Switch to PreferChocolatey Checkbox * Persist Choco Preference across program restarts * Change Logging, Fix interactivity and optimize uninstall * Implement "Get-Installed" (quick-and-dirty) * Code Formatting * Rename File/Function, Refactor Choco Install, Add Status Indicator * Add documentation --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
@ -2,25 +2,35 @@ function Invoke-WPFInstallUpgrade {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Invokes the function that upgrades all installed programs using winget
|
||||
Invokes the function that upgrades all installed programs
|
||||
|
||||
#>
|
||||
if((Test-WinUtilPackageManager -winget) -eq "not-installed") {
|
||||
return
|
||||
if ($sync.WPFpreferChocolatey.IsChecked) {
|
||||
Install-WinUtilChoco
|
||||
$chocoUpgradeStatus = (Start-Process "choco" -ArgumentList "upgrade all -y" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if ($chocoUpgradeStatus -eq 0) {
|
||||
Write-Host "Upgrade Successful"
|
||||
}
|
||||
else{
|
||||
Write-Host "Error Occured. Return Code: $chocoUpgradeStatus"
|
||||
}
|
||||
}
|
||||
else{
|
||||
if((Test-WinUtilPackageManager -winget) -eq "not-installed") {
|
||||
return
|
||||
}
|
||||
|
||||
if(Get-WinUtilInstallerProcess -Process $global:WinGetInstall) {
|
||||
$msg = "[Invoke-WPFInstallUpgrade] Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
if(Get-WinUtilInstallerProcess -Process $global:WinGetInstall) {
|
||||
$msg = "[Invoke-WPFInstallUpgrade] Install process is currently running. Please check for a powershell window labeled 'Winget Install'"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
|
||||
Update-WinUtilProgramWinget
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Updates started ---"
|
||||
Write-Host "-- You can close this window if desired ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
|
||||
# Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
Update-WinUtilProgramWinget
|
||||
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Updates started ---"
|
||||
Write-Host "-- You can close this window if desired ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
|
Reference in New Issue
Block a user