Refactors model filter event handling to core module

Moves the `TextChanged` event handler for the driver model filter from the UI script to the core `Register-EventHandlers` function.

This change centralizes the logic and makes the handler more generic by retrieving the UI state from the window's tag instead of relying on a global variable.
This commit is contained in:
rbalsleyMSFT
2025-06-17 16:11:18 -07:00
parent ab0b92ad5c
commit 07306ff209
2 changed files with 6 additions and 4 deletions
@@ -577,6 +577,12 @@ function Register-EventHandlers {
$eventSource.IsEnabled = $true
}
})
$State.Controls.txtModelFilter.Add_TextChanged({
param($sourceObject, $textChangedEventArgs)
$window = [System.Windows.Window]::GetWindow($sourceObject)
$localState = $window.Tag
Search-DriverModels -filterText $localState.Controls.txtModelFilter.Text -State $localState
})
}
Export-ModuleMember -Function *