winutil/functions/private/Get-WinUtilCheckBoxes.ps1
Chris Titus 3b133e704e
Test 2024 01 12 (#1401)
* change logseq url and add .net 8 (#1385)

* Update applications.json

Add Official logseq url 
Add .net runtime 8.0

* compile with new logseq and .net 8 runtime

* add thorium avx2

* Compile Winutil

* Remove Cider Music Player (#1400)

* Update winutil.ps1

* Update applications.json

* Compile Winutil

* Import/Export is now global, Settings menu added and many more improvements (#1398)

* Anoter one of those huge PRs
- Fix version inefficiency the version is already stored in sync, no need to slow down loading by one extra replace.
- Created custom dialog and About message
- Create a menu with Import/Export values
	- press on teh Settings cog in the right upper corner and save all the checkboxes
	- then you can either load them or load and run automatically
- Made Import Export load accross the whole app
- Optimized the way checkbox controls are looked up, it is 20% faster now
- Added a switch to load all the boxes from a config file
	- example: .winutil.ps1 -Config "C:UsersasdfDesktop\111.json"
- Added a switch to run all the action in unattended mode by passing -Run siwthc
	- example: .winutil.ps1 -Config "C:UsersasdfDesktop\111.json" -Run
	- This will run all the tweaks and install all the apps

* Fixing a couple of bugs and blur fonts, also menu now closes when focus is lost

---------

Co-authored-by: KonTy <KonTy@github.com>
Co-authored-by: Chris Titus <contact@christitus.com>

* Update applications.json

* Compile Winutil

* Add F8 Recovery Menu and Windows Reg Backup and others (#1389)

* Update feature.json append F8 legacy startup and Win Reg Backup and web search suggestion in search app

- enable automatic windows registry backup and do schedule for it as well (disabled by default in Win10, Win11) this will help when doing last known Good Configuration thru the F8 startup menu.
- enable / disable legacy F8 startup recovery option.
- enable / disable web search suggestions in the windows search in task bar.

* new tick boxes features. F8 recovery, regbackup, search web suggestions

- enable automatic windows registry backup and do schedule for it as well (disabled by default in Win10, Win11) this will help when doing last known Good Configuration thru the F8 startup menu.
- enable / disable legacy F8 startup recovery option.
- enable / disable web search suggestions in the windows search in task bar.

* Compile Winutil

* add Parsec to installable applications (#1157) (#1396)

Identifiers:
- Winget: Parsec.parsec
- Chocolatey: parsec

* Compile Winutil

* add Konty to About page

* Compile Winutil

* fix description (#1388) (#1402)

Co-authored-by: howell2024 <156375832+howell2024@users.noreply.github.com>

---------

Co-authored-by: Cristian Negulescu <cristian@clamsen.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: Tommi Pöntinen <98650216+hamburgerghini1@users.noreply.github.com>
Co-authored-by: KonTy <9524513+KonTy@users.noreply.github.com>
Co-authored-by: KonTy <KonTy@github.com>
Co-authored-by: Smartek <70715469+smartekIT@users.noreply.github.com>
Co-authored-by: Saikrishnan K <53394202+K-Saikrishnan@users.noreply.github.com>
Co-authored-by: howell2024 <156375832+howell2024@users.noreply.github.com>
2024-01-15 11:32:19 -06:00

78 lines
2.3 KiB
PowerShell

Function Get-WinUtilCheckBoxes {
<#
.SYNOPSIS
Finds all checkboxes that are checked on the specific tab and inputs them into a script.
.PARAMETER Group
The group of checkboxes to check
.PARAMETER unCheck
Whether to uncheck the checkboxes that are checked. Defaults to true
.OUTPUTS
A List containing the name of each checked checkbox
.EXAMPLE
Get-WinUtilCheckBoxes "WPFInstall"
#>
Param(
[boolean]$unCheck = $false
)
$Output = @{
Install = @()
WPFTweaks = @()
WPFFeature = @()
WPFInstall = @()
}
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] }
foreach ($CheckBox in $CheckBoxes) {
$group = if ($CheckBox.Key.StartsWith("WPFInstall")) { "Install" }
elseif ($CheckBox.Key.StartsWith("WPFTweaks")) { "WPFTweaks" }
elseif ($CheckBox.Key.StartsWith("WPFFeature")) { "WPFFeature" }
if ($group) {
if ($CheckBox.Value.IsChecked -eq $true) {
$feature = switch ($group) {
"Install" {
# Get the winget value
$wingetValue = $sync.configs.applications.$($CheckBox.Name).winget
if (-not [string]::IsNullOrWhiteSpace($wingetValue) -and $wingetValue -ne "na") {
$wingetValue -split ";"
} else {
$sync.configs.applications.$($CheckBox.Name).choco
}
}
default {
$CheckBox.Name
}
}
if (-not $Output.ContainsKey($group)) {
$Output[$group] = @()
}
if ($group -eq "Install") {
$Output["WPFInstall"] += $CheckBox.Name
Write-Debug "Adding: $($CheckBox.Name) under: WPFInstall"
}
Write-Debug "Adding: $($feature) under: $($group)"
$Output[$group] += $feature
if ($uncheck -eq $true) {
$CheckBox.Value.IsChecked = $false
}
}
}
}
return $Output
}