From bdf1b63833c83171aed63e8fc16702078ccd577b Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Tue, 9 Sep 2025 18:00:52 -0700 Subject: [PATCH] Improves UI state after environment autoload Updates the visibility of UI panels for Winget and drivers when a previous environment is automatically loaded. This ensures that if Winget apps or driver models are present, their corresponding UI sections are made visible. Additionally, it updates the "select all" checkbox state for Winget results and attempts to pre-select the hardware make for loaded drivers. --- .../FFUUI.Core/FFUUI.Core.Config.psm1 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 index 3666ee5..0f23d06 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 @@ -741,6 +741,14 @@ function Invoke-AutoLoadPreviousEnvironment { $State.Controls.lstWingetResults.ItemsSource = $appsBuffer.ToArray() $loadedWinget = $true WriteLog "AutoLoad: Winget AppList loaded with $($appsBuffer.Count) entries." + # Ensure Winget search/list panel is visible when apps are present + if ($null -ne $State.Controls.wingetSearchPanel) { + $State.Controls.wingetSearchPanel.Visibility = 'Visible' + } + # Update the Select All header checkbox state if present + if ($null -ne $State.Controls.chkSelectAllWingetResults -and (Get-Command -Name Update-SelectAllHeaderCheckBoxState -ErrorAction SilentlyContinue)) { + Update-SelectAllHeaderCheckBoxState -ListView $State.Controls.lstWingetResults -HeaderCheckBox $State.Controls.chkSelectAllWingetResults + } } else { WriteLog "AutoLoad: AppList JSON did not contain an 'apps' array." @@ -855,6 +863,25 @@ function Invoke-AutoLoadPreviousEnvironment { } $loadedDrivers = $true WriteLog "AutoLoad: Loaded $($State.Data.allDriverModels.Count) driver model entries." + + # Ensure driver-related panels are visible since models were auto-loaded + if ($null -ne $State.Controls.spModelFilterSection) { $State.Controls.spModelFilterSection.Visibility = 'Visible' } + if ($null -ne $State.Controls.lstDriverModels) { $State.Controls.lstDriverModels.Visibility = 'Visible' } + if ($null -ne $State.Controls.spDriverActionButtons) { $State.Controls.spDriverActionButtons.Visibility = 'Visible' } + + # Optionally set Make combo to the first make represented in the loaded list (if none selected yet) + try { + if ($State.Controls.cmbMake.SelectedIndex -lt 0 -and $State.Data.allDriverModels.Count -gt 0) { + $firstMake = ($State.Data.allDriverModels | Select-Object -First 1).Make + if (-not [string]::IsNullOrWhiteSpace($firstMake)) { + $makeItem = $State.Controls.cmbMake.Items | Where-Object { $_ -eq $firstMake } | Select-Object -First 1 + if ($makeItem) { $State.Controls.cmbMake.SelectedItem = $makeItem } + } + } + } + catch { + WriteLog "AutoLoad: Non-fatal error setting Make selection: $($_.Exception.Message)" + } } else { WriteLog "AutoLoad: Drivers JSON empty or did not contain expected structure."