mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
Simple changes to 'Invoke-WPFTab' Public Function (#2976)
* 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
This commit is contained in:
parent
c418fe9030
commit
e2b9586b0d
@ -10,17 +10,18 @@ function Invoke-WPFTab {
|
|||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
Param ($ClickedTab)
|
Param (
|
||||||
|
[Parameter(Mandatory,position=0)]
|
||||||
|
[string]$ClickedTab
|
||||||
|
)
|
||||||
|
|
||||||
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
|
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
|
||||||
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
||||||
|
|
||||||
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
|
$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) {
|
if ($ClickedTab -ne $PSItem.name) {
|
||||||
$sync[$PSItem.Name].IsChecked = $false
|
$sync[$PSItem.Name].IsChecked = $false
|
||||||
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
|
|
||||||
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
|
|
||||||
} else {
|
} else {
|
||||||
$sync["$ClickedTab"].IsChecked = $true
|
$sync["$ClickedTab"].IsChecked = $true
|
||||||
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
||||||
|
Loading…
Reference in New Issue
Block a user