2023-05-09 13:14:27 -05:00
|
|
|
function Invoke-WPFGetInstalled {
|
|
|
|
<#
|
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.SYNOPSIS
|
|
|
|
Invokes the function that gets the checkboxes to check in a new runspace
|
|
|
|
|
|
|
|
.PARAMETER checkbox
|
|
|
|
Indicates whether to check for installed 'winget' programs or applied 'tweaks'
|
2023-05-09 13:14:27 -05:00
|
|
|
|
|
|
|
#>
|
|
|
|
param($checkbox)
|
|
|
|
|
|
|
|
if($sync.ProcessRunning){
|
2024-01-15 11:32:19 -06:00
|
|
|
$msg = "[Invoke-WPFGetInstalled] Install process is currently running."
|
2023-05-09 13:14:27 -05:00
|
|
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(Test-WinUtilPackageManager -winget) -and $checkbox -eq "winget"){
|
|
|
|
Write-Host "==========================================="
|
|
|
|
Write-Host "-- Winget is not installed ---"
|
|
|
|
Write-Host "==========================================="
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-01-15 11:32:19 -06:00
|
|
|
Invoke-WPFRunspace -ArgumentList $checkbox,$DebugPreference -ScriptBlock {
|
|
|
|
param($checkbox, $DebugPreference)
|
2023-05-09 13:14:27 -05:00
|
|
|
|
|
|
|
$sync.ProcessRunning = $true
|
|
|
|
|
|
|
|
if($checkbox -eq "winget"){
|
|
|
|
Write-Host "Getting Installed Programs..."
|
|
|
|
}
|
|
|
|
if($checkbox -eq "tweaks"){
|
|
|
|
Write-Host "Getting Installed Tweaks..."
|
|
|
|
}
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-05-09 13:14:27 -05:00
|
|
|
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-05-09 13:14:27 -05:00
|
|
|
$sync.form.Dispatcher.invoke({
|
|
|
|
foreach($checkbox in $Checkboxes){
|
|
|
|
$sync.$checkbox.ischecked = $True
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
Write-Host "Done..."
|
|
|
|
$sync.ProcessRunning = $false
|
|
|
|
}
|
|
|
|
}
|