mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
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:
@@ -169,10 +169,6 @@ $window.Add_Loaded({
|
|||||||
$script:uiState.Controls.spModelFilterSection.Visibility = 'Collapsed'
|
$script:uiState.Controls.spModelFilterSection.Visibility = 'Collapsed'
|
||||||
$script:uiState.Controls.lstDriverModels.Visibility = 'Collapsed'
|
$script:uiState.Controls.lstDriverModels.Visibility = 'Collapsed'
|
||||||
$script:uiState.Controls.spDriverActionButtons.Visibility = 'Collapsed'
|
$script:uiState.Controls.spDriverActionButtons.Visibility = 'Collapsed'
|
||||||
$script:uiState.Controls.txtModelFilter.Add_TextChanged({
|
|
||||||
param($sourceObject, $textChangedEventArgs)
|
|
||||||
Search-DriverModels -filterText $script:uiState.Controls.txtModelFilter.Text -State $script:uiState
|
|
||||||
})
|
|
||||||
$script:uiState.Controls.btnDownloadSelectedDrivers.Add_Click({
|
$script:uiState.Controls.btnDownloadSelectedDrivers.Add_Click({
|
||||||
param($buttonSender, $clickEventArgs)
|
param($buttonSender, $clickEventArgs)
|
||||||
|
|
||||||
|
|||||||
@@ -577,6 +577,12 @@ function Register-EventHandlers {
|
|||||||
$eventSource.IsEnabled = $true
|
$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 *
|
Export-ModuleMember -Function *
|
||||||
|
|||||||
Reference in New Issue
Block a user