winutil/functions/public/Invoke-WPFPresets.ps1
Chris Titus f6b416ee90
Test 05 2023 - Typos and Minor Bug Fixes (#736)
* Fix inputxml file (#730)

* Compile Winutil

* Fix object name of programs

* fix Width of buttons

* Updated winutil picture (screen-install.png)

---------

Co-authored-by: padsalatushal <padsalatushal@users.noreply.github.com>

* Fix #649 : revo uninstaller package name  (#732)

* Compile Winutil

* fix package name of revo unistaller

---------

Co-authored-by: padsalatushal <padsalatushal@users.noreply.github.com>

* Fix import export feature on tweak section (#733)

* Compile Winutil

* fix typo :)

---------

Co-authored-by: padsalatushal <padsalatushal@users.noreply.github.com>

* Compile Winutil

---------

Co-authored-by: Padsala Tushal <57517785+padsalatushal@users.noreply.github.com>
Co-authored-by: padsalatushal <padsalatushal@users.noreply.github.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
2023-05-10 21:09:46 -05:00

41 lines
1.3 KiB
PowerShell

function Invoke-WPFPresets {
<#
.DESCRIPTION
Meant to make settings presets easier in the tweaks tab. Will pull the data from config/preset.json
#>
param(
$preset,
[bool]$imported = $false,
$checkbox = "WPFTeaks"
)
if($imported -eq $true){
$CheckBoxesToCheck = $preset
}
Else{
$CheckBoxesToCheck = $sync.configs.preset.$preset
}
if($checkbox -eq "WPFTweaks"){
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "*tweaks*"}
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
if ($CheckBoxesToCheck -contains $PSItem.name){
$sync.$($PSItem.name).ischecked = $true
}
else{$sync.$($PSItem.name).ischecked = $false}
}
}
if($checkbox -eq "WPFInstall"){
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPFInstall*"}
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
if($($sync.configs.applications.$($psitem.name).winget) -in $CheckBoxesToCheck){
$sync.$($PSItem.name).ischecked = $true
}
else{$sync.$($PSItem.name).ischecked = $false}
}
}
}