mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 09:31:15 +10:00
* fix: resolve silent failures in AppX removal and PS7 DISM bugs
- Fixed a bug where Remove-AppxPackage failed silently in PowerShell 7 due to pipeline binding issues. We now explicitly loop through Get-AppxPackage results and pass PackageFullName directly.
- Added wildcard matching to Get-AppxPackage and Get-AppxProvisionedPackage to reliably locate packages regardless of short name vs family name variations.
- Offloaded Get-AppxProvisionedPackage and Remove-AppxProvisionedPackage execution to Windows PowerShell 5.1 (powershell.exe) to bypass PowerShell 7 DISM COM exceptions ("Class not registered") and performance hangs.
- Deduplicated AppX removal logic by calling Remove-WinUtilAPPX directly from Invoke-WPFAppxRemoval instead of copying the implementation.
* refactor(Remove-WinUtilAPPX): use script block to improve readability
* feat: enhance AppX removal process and add provisioned package removal function
* fix(tests): update AppX removal tests
This also adds tests for the new Remove-WinUtilProvisionedAPPX functionality
* Move AppX removal under Tweaks
* Address AppX removal review feedback
* Complete AppX removal error handling
* Prevent AppX cleanup confirmation prompts
---------
Co-authored-by: Chris Titus <contact@christitus.com>
62 lines
2.2 KiB
PowerShell
62 lines
2.2 KiB
PowerShell
function Invoke-WPFTab {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Sets the selected tab to the tab that was clicked
|
|
|
|
.PARAMETER ClickedTab
|
|
The name of the tab that was clicked
|
|
|
|
#>
|
|
|
|
Param (
|
|
[Parameter(Mandatory,position=0)]
|
|
[string]$ClickedTab
|
|
)
|
|
|
|
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
|
|
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
|
|
|
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
|
|
$sync.$tabNav.Items[$tabNumber].IsSelected = $true
|
|
($sync.GetEnumerator()).where{$psitem.Key -in $filter} | ForEach-Object {
|
|
if ($ClickedTab -ne $PSItem.name) {
|
|
$sync[$PSItem.Name].IsChecked = $false
|
|
} else {
|
|
$sync["$ClickedTab"].IsChecked = $true
|
|
}
|
|
}
|
|
$sync.currentTab = $sync.$tabNav.Items[$tabNumber].Header
|
|
Initialize-WinUtilTabContent -TabName $sync.currentTab
|
|
|
|
# Always reset the filter for the current tab
|
|
if ($sync.currentTab -eq "Install") {
|
|
# Reset Install tab filter
|
|
Find-AppsByNameOrDescription -SearchString ""
|
|
} elseif ($sync.currentTab -eq "Tweaks") {
|
|
# Reset Tweaks tab filter
|
|
Find-TweaksByNameOrDescription -SearchString ""
|
|
} elseif ($sync.currentTab -eq "AppX") {
|
|
# Reset AppX tab filter
|
|
Find-TweaksByNameOrDescription -SearchString ""
|
|
}
|
|
|
|
# Show search bar in Install, Tweaks, and AppX tabs
|
|
if ($tabNumber -eq 0 -or $tabNumber -eq 1 -or $tabNumber -eq 5) {
|
|
$sync.SearchBar.Visibility = "Visible"
|
|
$searchIcon = ($sync.Form.FindName("SearchBar").Parent.Children | Where-Object { $_ -is [System.Windows.Controls.TextBlock] -and $_.Text -eq [char]0xE721 })[0]
|
|
if ($searchIcon) {
|
|
$searchIcon.Visibility = "Visible"
|
|
}
|
|
} else {
|
|
$sync.SearchBar.Visibility = "Collapsed"
|
|
$searchIcon = ($sync.Form.FindName("SearchBar").Parent.Children | Where-Object { $_ -is [System.Windows.Controls.TextBlock] -and $_.Text -eq [char]0xE721 })[0]
|
|
if ($searchIcon) {
|
|
$searchIcon.Visibility = "Collapsed"
|
|
}
|
|
# Hide the clear button if it's visible
|
|
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
|
}
|
|
}
|