Refactor function names and improve code formatting

Renames functions for better semantic clarity:
- `Refresh-WindowsSettingsCombos` becomes `Initialize-WindowsSettingsCombos` to better reflect its role in initial UI setup.
- `Filter-DriverModels` becomes `Search-DriverModels` to more accurately describe its use in user-driven model searches.

Enhances code readability in the UI script through consistent formatting of event handlers and multi-line script blocks.
This commit is contained in:
rbalsleyMSFT
2025-06-16 19:37:58 -07:00
parent fb9dc3fbc5
commit f1d0ab20cb
3 changed files with 103 additions and 43 deletions
@@ -112,7 +112,7 @@ function ConvertTo-StandardizedDriverModel {
}
# Function to filter the driver model list based on text input
function Filter-DriverModels {
function Search-DriverModels {
param(
[string]$filterText,
[Parameter(Mandatory = $true)]
@@ -120,7 +120,7 @@ function Filter-DriverModels {
)
# Check if UI elements and the full list are available
if ($null -eq $State.Controls.lstDriverModels -or $null -eq $State.Data.allDriverModels) {
WriteLog "Filter-DriverModels: ListView or full model list not available."
WriteLog "Search-DriverModels: ListView or full model list not available."
return
}
@@ -371,7 +371,7 @@ function Import-DriversJson {
$State.Data.allDriverModels = $State.Data.allDriverModels | Sort-Object @{Expression = { $_.IsSelected }; Descending = $true }, Make, Model
Filter-DriverModels -filterText $State.Controls.txtModelFilter.Text -State $script:uiState
Search-DriverModels -filterText $State.Controls.txtModelFilter.Text -State $script:uiState
$message = "Driver import complete.`nNew models added: $newModelsAdded`nExisting models updated: $existingModelsUpdated"
[System.Windows.MessageBox]::Show($message, "Import Successful", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Information)
@@ -463,8 +463,8 @@ function Update-WindowsSkuCombo {
}
}
# Combined function to refresh both Release and Version combos
function Refresh-WindowsSettingsCombos {
# Combined function to initialize the Release, Version, and SKU combos
function Initialize-WindowsSettingsCombos {
param(
[string]$isoPath,
[Parameter(Mandatory = $true)]
@@ -568,4 +568,4 @@ function BuildFeaturesGrid {
# SECTION: Module Export
# --------------------------------------------------------------------------
Export-ModuleMember -Function Get-WindowsSettingsDefaults, Get-AvailableWindowsReleases, Get-AvailableWindowsVersions, Get-AvailableSkusForRelease, Update-WindowsReleaseCombo, Update-WindowsVersionCombo, Update-WindowsSkuCombo, Refresh-WindowsSettingsCombos, UpdateOptionalFeaturesString, BuildFeaturesGrid
Export-ModuleMember -Function Get-WindowsSettingsDefaults, Get-AvailableWindowsReleases, Get-AvailableWindowsVersions, Get-AvailableSkusForRelease, Update-WindowsReleaseCombo, Update-WindowsVersionCombo, Update-WindowsSkuCombo, Initialize-WindowsSettingsCombos, UpdateOptionalFeaturesString, BuildFeaturesGrid