winutil/functions/public/Invoke-WPFButton.ps1
Martin Wiethan 0251757fc0
Add the option to change the UI Theme at runtime (#2693)
* Setup for testing

* Working Example for Background

* Almost all MainBackgrounColor working

* Random Color PoC

* Fix DBorderColor

* prevent old logic from replacing colors in memory at startup

* Comment out resources in xaml

* Finish new Button

* Remove Pulse, Load Windows default Theme

* Fix Colors

* Fix Toggle Colors

* working version, with shared still being mostly applied be replace instead of resouces

* Load all entries in themes.json as Resource and reference them in inputXML.xaml

* Rename File to match Function Name

* Hotfix for Sync with main

* Remove Static Set-WinUtilUITheme function/file

* Rename File and Function

* Cleanup and Stuff

* Unify Button Theme with rest of UI

* Refactor/Optimazation

* Performance optimization

* Add Comments

* Rename Functions and Variables to be more concise and descriptive

* Add persistence to the user Theme Preference across winutil restarts

* Reimplement Theme Chagnes from #2722

* Add AUTO option to follow window theme and add dropdown instead toggle

* Formatting and deleting temp file

* Fix small display bug where Dropdown would remain open for settings and themes

* Remove terniary operators because only PS7+ is supported
2024-09-20 08:34:10 -05:00

63 lines
2.8 KiB
PowerShell

function Invoke-WPFButton {
<#
.SYNOPSIS
Invokes the function associated with the clicked button
.PARAMETER Button
The name of the button that was clicked
#>
Param ([string]$Button)
# Use this to get the name of the button
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
if (-not $sync.ProcessRunning) {
Set-WinUtilProgressBar -label "" -percent 0 -hide $true
}
Switch -Wildcard ($Button) {
"WPFTab?BT" {Invoke-WPFTab $Button}
"WPFInstall" {Invoke-WPFInstall}
"WPFUninstall" {Invoke-WPFUnInstall}
"WPFInstallUpgrade" {Invoke-WPFInstallUpgrade}
"WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"}
"WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"}
"WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"}
"WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"}
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
"WPFOOSUbutton" {Invoke-WPFOOSU}
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"}
"WPFRemoveUltPerf" {Invoke-WPFUltimatePerformance -State "Disable"}
"WPFundoall" {Invoke-WPFundoall}
"WPFFeatureInstall" {Invoke-WPFFeatureInstall}
"WPFPanelDISM" {Invoke-WPFPanelDISM}
"WPFPanelAutologin" {Invoke-WPFPanelAutologin}
"WPFPanelcontrol" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelnetwork" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelpower" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelregion" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelsound" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelprinter" {Invoke-WPFControlPanel -Panel $button}
"WPFPanelsystem" {Invoke-WPFControlPanel -Panel $button}
"WPFPaneluser" {Invoke-WPFControlPanel -Panel $button}
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
"WPFFixesUpdate" {Invoke-WPFFixesUpdate}
"WPFFixesWinget" {Invoke-WPFFixesWinget}
"WPFRunAdobeCCCleanerTool" {Invoke-WPFRunAdobeCCCleanerTool}
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-WPFGetIso}
"WPFMicrowin" {Invoke-WPFMicrowin}
"WPFCloseButton" {Invoke-WPFCloseButton}
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
"WPFWinUtilPSProfile" {Invoke-WinUtilpsProfile}
}
}