winutil/functions/public/Invoke-WPFButton.ps1
Martin Wiethan e7328c2739
Complete Winget Install Overhaul and Progress Bar in GUI (#2466)
* Compile Winutil

* first draft for Progress bar in GUI

* small optimizations to the loading bar

* Optimize the Winget Installation Function to make it more maintainable

* Apply loading bar to Tweaks

* Update colors

* Add docs

* Fix value range for the taskbar item

* Remove winutil.ps1 from PR

* Documention and fix an oversight in the uninstall logic

* Reduce even more repeaded code

---------

Co-authored-by: Marterich <Marterich@users.noreply.github.com>
2024-07-30 21:13:30 -05:00

61 lines
2.6 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"}
"WPFminimal" {Invoke-WPFPresets "Minimal"}
"WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
"WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "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}
"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}
}
}