mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
11084f6689
- Moved Get-UIConfig from BuildFFUVM_UI.ps1 to FFUUI.Core.psm1 to enhance separation of concerns. - Updated Get-UIConfig to accept a central $State object, removing direct dependencies on global UI variables. - Modified internal logic to access UI control values from the $State.Controls hashtable. - Updated calls in BuildFFUVM_UI.ps1 to pass the $script:uiState object to the refactored function. - Exported Get-UIConfig from FFUUI.Core.psm1 for accessibility in the main UI script.
2.3 KiB
2.3 KiB
- Work item name: Refactor
Get-UIConfig - Work item issue (e.g. what is the work item solving): The
Get-UIConfigfunction currently accesses UI elements directly, making it tightly coupled to the main UI script and harder to maintain and test. This work item will refactor it to accept a central state object, improving modularity and aligning with the project's overall refactoring goals. - Work Item plan:
- What the plan is: I will modify the
Get-UIConfigfunction inFFUUI.Core.psm1. The function will be updated to accept a single$Stateobject as a parameter. Inside the function, all references to UI controls will be changed to access them from the$State.Controlshashtable. This will decouple the function from the main script's global variables. I will then update the call to this function inBuildFFUVM_UI.ps1to pass the new$script:uiStateobject. - Files modified:
FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1FFUDevelopment/BuildFFUVM_UI.ps1
- Global/script variables and/or parameters created: None
- Functions created: None
- Any other important functionality: This change is a key part of the "Tame the script: Scope with a Central State Object" initiative. It will make the code cleaner, more maintainable, and easier to debug.
- What the plan is: I will modify the
Current Work Item
Summary of Changes
- Refactored
Get-UIConfigfunction:- Moved the
Get-UIConfigfunction fromBuildFFUVM_UI.ps1to theFFUUI.Core.psm1module to improve code modularity and separation of concerns. - Modified the function to accept a central
$Stateobject as a parameter, eliminating direct dependencies on global UI variables like$window. - Updated all internal logic within
Get-UIConfigto retrieve UI control values from the$State.Controlshashtable (e.g.,$State.Controls.chkCompactOS.IsChecked). - Updated the function calls in
BuildFFUVM_UI.ps1(within thebtnRunandbtnBuildConfigclick events) to pass the$script:uiStateobject to the refactored function. - Exported
Get-UIConfigfrom theFFUUI.Core.psm1module, making it accessible to the main UI script.
- Moved the
- Files Modified:
FFUDevelopment/BuildFFUVM_UI.ps1: Removed the original function definition and updated the calls.FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1: Added the refactored function and exported it.