Improve driver list data handling and filtering

Refactors the driver selection UI to enhance stability and performance by changing how the underlying data source is managed. Creating and re-assigning a new list when data changes, rather than modifying the bound collection in-place, prevents UI inconsistency errors.

- Updates the model search to use the native WPF `CollectionView.Filter` for more efficient and reliable filtering.
- Fixes an issue where HTML entities were not decoded in Microsoft driver model names.
- Ensures selected drivers from one manufacturer are preserved when fetching models for another.
- Centralizes driver-related button event handlers into the core initialization module.
This commit is contained in:
rbalsleyMSFT
2025-06-17 18:25:06 -07:00
parent f014d7ffcd
commit 87c9bc769e
4 changed files with 94 additions and 51 deletions
-13
View File
@@ -169,19 +169,6 @@ $window.Add_Loaded({
$script:uiState.Controls.spModelFilterSection.Visibility = 'Collapsed'
$script:uiState.Controls.lstDriverModels.Visibility = 'Collapsed'
$script:uiState.Controls.spDriverActionButtons.Visibility = 'Collapsed'
$script:uiState.Controls.btnClearDriverList.Add_Click({
$script:uiState.Controls.lstDriverModels.ItemsSource = $null
$script:uiState.Data.allDriverModels = @()
$script:uiState.Controls.txtModelFilter.Text = ""
$script:uiState.Controls.txtStatus.Text = "Driver list cleared."
})
$script:uiState.Controls.btnSaveDriversJson.Add_Click({
Save-DriversJson -State $script:uiState
})
$script:uiState.Controls.btnImportDriversJson.Add_Click({
Import-DriversJson -State $script:uiState
})
# Office interplay (Keep existing logic)
$script:uiState.Flags.installAppsCheckedByOffice = $false
if ($script:uiState.Controls.chkInstallOffice.IsChecked) {