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
@@ -11,8 +11,6 @@ function Get-MicrosoftDriversModelList {
try {
WriteLog "Getting Surface driver information from $url"
WriteLog "Using UserAgent: $UserAgent"
WriteLog "Using Headers: $($Headers | Out-String)"
$OriginalVerbosePreference = $VerbosePreference
$VerbosePreference = 'SilentlyContinue'
# Use passed-in UserAgent and Headers
@@ -41,7 +39,7 @@ function Get-MicrosoftDriversModelList {
$cellMatches = [regex]::Matches($rowContent, $cellPattern, [System.Text.RegularExpressions.RegexOptions]::Singleline)
if ($cellMatches.Count -ge 2) {
$modelName = ($cellMatches[0].Groups[1].Value).Trim()
$modelName = ([System.Net.WebUtility]::HtmlDecode(($cellMatches[0].Groups[1].Value).Trim()))
$secondTdContent = $cellMatches[1].Groups[1].Value.Trim()
# $linkPattern = '<a[^>]+href="([^"]+)"[^>]*>'
# Change linkPattern to match https://www.microsoft.com/download/details.aspx?id=