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:
@ -1,6 +1,6 @@
|
||||
function Invoke-WPFGetInstalled {
|
||||
<#
|
||||
|
||||
TODO: Add the Option to use Chocolatey as Engine
|
||||
.SYNOPSIS
|
||||
Invokes the function that gets the checkboxes to check in a new runspace
|
||||
|
||||
@ -16,12 +16,12 @@ function Invoke-WPFGetInstalled {
|
||||
return
|
||||
}
|
||||
|
||||
if(((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
if(($sync.WPFpreferChocolatey.IsChecked -eq $false) -and ((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
return
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($checkbox, $DebugPreference)
|
||||
$preferChoco = $sync.WPFpreferChocolatey.IsChecked
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($checkbox, $preferChoco, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||
@ -32,8 +32,12 @@ function Invoke-WPFGetInstalled {
|
||||
if($checkbox -eq "tweaks") {
|
||||
Write-Host "Getting Installed Tweaks..."
|
||||
}
|
||||
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
||||
if ($preferChoco -and $checkbox -eq "winget") {
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox "choco"
|
||||
}
|
||||
else{
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.invoke({
|
||||
foreach($checkbox in $Checkboxes) {
|
||||
|
Reference in New Issue
Block a user