Skip to content

Commit

Permalink
Simple changes to 'Invoke-WPFTab' Public Function (#2976)
Browse files Browse the repository at this point in the history
* Improve 'Invoke-WPFTab' Parameter by specifying its type (as expected by the function) and make it Mandatory

* Simple performance increases in 'Invoke-WPFTab' function - Use where method instead of piping the result into Where-Object

* Remove commented-out code in 'Invoke-WPFTab' function
  • Loading branch information
og-mrk authored Nov 7, 2024
1 parent c418fe9 commit e2b9586
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/public/Invoke-WPFTab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ function Invoke-WPFTab {
#>

Param ($ClickedTab)
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.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
($sync.GetEnumerator()).where{$psitem.Key -in $filter} | ForEach-Object {
if ($ClickedTab -ne $PSItem.name) {
$sync[$PSItem.Name].IsChecked = $false
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
} else {
$sync["$ClickedTab"].IsChecked = $true
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
Expand Down

0 comments on commit e2b9586

Please sign in to comment.