Commit Graph

122 Commits

Author SHA1 Message Date
rbalsleyMSFT 7678f61480 Updates UI layout to a modern navigation sidebar and adds Fluent theme support
Refactors the main window layout to use a sidebar navigation model instead of a standard tab control, improving the overall organization of the application.
Introduces support for the Fluent theme (Light, Dark, and System) for users running PowerShell 7.5+ (.NET 9+), gracefully falling back to standard styling for older versions.
Adds a new Settings page that allows users to configure the application theme and access helpful documentation and repository links.
Standardizes margins, font sizes, and layout choices across all forms to closer match Windows design guidelines.
Updates configuration handling to save and restore user theme preferences.
2026-03-20 13:07:40 -07:00
rbalsleyMSFT 9bacac8f3d Fixes working directory handling
Ensures build and cleanup processes run from the expected project location.

Prevents temporary state files from being created or removed in the wrong folder, which avoids stale markers and cleanup failures when launched from the UI or another directory.
2026-03-10 17:01:40 -07:00
rbalsleyMSFT 1feed40962 Runs builds in pwsh process for reliable cancel
Improves UI responsiveness and interactive behavior by running build/cleanup in a separate PowerShell process instead of background jobs.

Fixes cancellation reliability by terminating the full process tree (including child tools) and using process exit codes for success/failure reporting.

Reduces noisy output by suppressing type-add return values and standardizes cleanup argument passing to avoid switch/boolean binding issues.
2026-01-29 22:21:15 -08:00
arwidmark 458f1e517c Update BuildFFUVM_UI.ps1 2025-10-20 23:06:18 -05:00
rbalsleyMSFT 6562d16ce5 Standardizes JSON output: depth, UTF-8, key order
- Sorts top-level config keys before serialization for deterministic files and cleaner diffs.
- Increases JSON depth to 10 to retain nested settings.
- Writes JSON as UTF-8 via Set-Content for consistent encoding.
- Applies across config export and UI save flows.
2025-09-20 13:30:41 -07:00
rbalsleyMSFT 15a5b16b39 Adds UI/CLI to copy additional FFUs to USB build
- Enables selecting multiple existing FFU images to include on the deployment USB for easier distribution and testing.
- Adds a UI option with selectable, sortable list from the capture folder, refresh support, and persisted selections.
- Validates that selections exist when the option is enabled to prevent empty runs.
- Supports unattended/CLI flows by prompting early or accepting a preselected list for USB creation; deduplicates and logs chosen files.
- Always includes the just-built (or latest available) FFU as a base.
- Improves no-FFU handling and streamlines multi-FFU selection workflow.
2025-09-18 18:17:58 -07:00
rbalsleyMSFT 3ef26f2918 Adds auto-loading of previous configuration on startup
Implements a new feature to automatically load the previously saved environment when the UI is launched.

This improves user experience by restoring the last saved configuration, including selected applications and drivers, eliminating the need to manually reload them on each run.

The process loads the main `FFUConfig.json` and then proceeds to load associated Winget, BYO App, and Driver lists if they are defined. UI elements and checkboxes are updated accordingly to reflect the loaded state.
2025-09-09 17:49:36 -07:00
rbalsleyMSFT 3c545be5c5 Hardens driver downloads and cleanup
Adds in‑progress markers around OEM driver downloads to enable recovery and reliable post‑run cleanup.

Refactors driver cleanup to be run‑aware: maps download targets to model folders, removes temp/model content created during the run, prunes empties, and preserves existing make roots via creation‑time checks.

Includes the Drivers folder in current‑run cleanup with safer rules to avoid deleting pre‑existing content.

Improves Office process termination by resolving the Office path (prefers UI value) and only acting when a valid folder exists.
2025-08-11 19:36:58 -07:00
rbalsleyMSFT 7c3de6d77f feat: Add cleanup functionality and improve build cancellation process in UI
- Introduced flags to track if a build is in progress and if cleanup is running.
- Enhanced the button click handler to allow users to cancel an ongoing build and initiate a cleanup process.
- Implemented a mechanism to stop background jobs and terminate associated processes during cancellation.
- Added logic to manage log file reading during cleanup and ensure proper UI updates.
- Updated the state management to reflect the current operation status accurately.
2025-08-08 18:22:40 -07:00
rbalsleyMSFT 138fd1184c Remove debugging code
Removes temporary debug logging from the UI window's closed event handler.
2025-07-24 10:38:08 -07:00
rbalsleyMSFT 791040364b Improves error reporting for failed FFU builds
Refactors the error handling for failed build jobs to more reliably capture the root cause of the failure.

The logic now uses `Receive-Job` with an `ErrorVariable` to directly capture the error stream from the job, which provides a more accurate terminating error message than the previous method.

Additionally, the error message box now includes the full path to the log file, making it easier for the user to locate.
2025-07-23 19:37:51 -07:00
rbalsleyMSFT 1b80d008ef Stops running build job when UI is closed
Adds cleanup logic to the window's `Closed` event handler to properly terminate any active background build job.

This prevents the build process from becoming an orphaned job if the user closes the UI while a build is in progress. The change ensures the job, its polling timer, and log streams are all stopped and disposed of correctly.
2025-07-22 13:54:41 -07:00
rbalsleyMSFT 6df7b16cdf Docs: Add PowerShell comment-based help to all script modules
Adds standard PowerShell comment-based help blocks (synopsis and description) to all UI and common library script modules (`.psm1`) and the main UI entry point script (`.ps1`).

This improves maintainability and discoverability by documenting the purpose of each script file. Also removes various redundant or commented-out code blocks.
2025-07-18 14:52:03 -07:00
rbalsleyMSFT 7cc7919da4 Feat: Add configurable thread limit for parallel operations
Adds a "Threads" setting to the UI, allowing users to control the throttle limit for parallel tasks like driver and application processing.

This introduces a new textbox in the build options and updates the parallel processing function to use this configurable value instead of a hardcoded one.

Input validation is also added to ensure the threads value is a valid integer and is at least 1. The new setting is integrated into the configuration save/load functionality.
2025-07-18 13:45:58 -07:00
rbalsleyMSFT ca84f4dfea Implement conditional autoscroll in log monitor
Improves the user experience in the monitor tab by making the log output autoscroll conditional.

Autoscrolling is now disabled when the user selects a log entry other than the last one, allowing them to inspect previous output without interruption. Selecting the last item in the list re-enables autoscrolling.
2025-07-14 17:56:51 -07:00
rbalsleyMSFT 08c9d5a0e3 feat: Add progress reporting to FFU build process
Introduces a progress reporting system to provide real-time feedback during the FFU build. This includes adding a progress bar and status messages to the UI, which are updated at key stages of the build process.

- Adds a new `Set-Progress` function to log progress updates.
- Integrates `Set-Progress` calls throughout the main build script.
- Updates the UI to parse progress logs and update the progress bar and status text.
- Improves error reporting in the UI to display more detailed failure reasons.
- Corrects a typo in the `LogicalSectorSizeBytes` parameter name in documentation and log messages.
2025-07-11 16:43:42 -07:00
rbalsleyMSFT 4a719b6c9a Improves reliability of build log monitoring
Deletes the old log file before starting a new build job to prevent the UI from displaying stale content from a previous run.

Replaces a fixed delay with a more robust wait loop that polls for the new log file's creation. This avoids a race condition where the monitor could fail to attach if the background job was slow to start. A timeout is included to prevent the UI from hanging.
2025-07-10 21:59:19 -07:00
rbalsleyMSFT 7043af47c3 Feat: Add live log monitoring tab to UI
Introduces a new "Monitor" tab in the `BuildFFUVM` UI to display live log output from the build process.

When a build is started, the UI now automatically switches to the Monitor tab. It tails the main log file in real-time and displays the content in a list view, which auto-scrolls as new entries appear.

This provides immediate visual feedback on the build progress and any errors without needing to manually open the log file.

Additionally, this change adds a Ctrl+C keyboard shortcut to copy selected log lines from the monitor view to the clipboard.
2025-07-10 19:56:59 -07:00
rbalsleyMSFT ebbb3e8ed0 Run build process in background job to keep UI responsive
Refactors the FFU build process to execute asynchronously using a background job. This prevents the UI from freezing during the build.

A timer now polls the job status and updates the UI with the final result (success or failure) upon completion. The build button is also disabled while a build is in progress to prevent multiple executions.
2025-07-10 18:00:03 -07:00
rbalsleyMSFT f9a8e3149f Adds a "Verbose" checkbox to the UI, allowing users to enable write-verbose output from the underlying build script.
This helps in troubleshooting the FFU build process by providing more detailed output to the console. The verbose setting is saved to and loaded from the configuration file.
2025-07-09 09:50:26 -07:00
rbalsleyMSFT 2e497ccec8 Refactor: Pre-process Dell catalog before parallel downloads
Moves the Dell catalog download and preparation logic from the individual driver download task to the parent function.

This prevents a race condition where multiple parallel tasks would attempt to download and extract the same catalog file simultaneously. The catalog is now prepared once before any driver downloads begin, improving efficiency and reliability.

Additionally, comments out manual garbage collection calls in the VM build UI.
2025-06-20 16:30:23 -07:00
rbalsleyMSFT d0c5ddc9c7 Refactor UI config logic into a core module
Moves the logic for saving and loading configuration files from the main UI script into the `FFUUI.Core.Config` module. This change improves modularity and separation of concerns, making the code easier to maintain.

The main `BuildFFUVM_UI.ps1` script is simplified, with event handlers now calling the new, dedicated functions in the core module to manage configuration state.

Also corrects the path for the `FFUConfig.json` file.
2025-06-20 14:25:39 -07:00
rbalsleyMSFT ca0a51ec15 Refactor VM Switch initialization logic
Move the `Initialize-VMSwitchData` function call from the main UI script into the `Initialize-UIDefaults` function.

This change centralizes the UI default initialization logic within the core module, improving code organization and ensuring VM Switch data is loaded at the correct time.
2025-06-19 19:16:11 -07:00
rbalsleyMSFT 244aba88d3 Refactor UI initialization into core module
Moves UI initialization logic for the "Bring Your Own" applications section from the main UI script into the `FFUUI.Core` module.

This centralization cleans up the main script's `Loaded` event handler and improves code organization and maintainability.
2025-06-19 19:06:56 -07:00
rbalsleyMSFT 4b7e815c68 Refactor Applications tab UI event handling
Consolidates the scattered event handlers for the Applications tab checkboxes into a single, centralized function and a shared event handler. This new approach manages the visibility of all dependent UI panels based on the state of the checkboxes.

This refactoring simplifies the codebase, eliminates redundant logic, and ensures a more consistent and predictable user interface state.

Additionally, this change fixes bugs where clearing list views for Winget results and drivers did not properly update their "select all" header checkboxes.
2025-06-19 18:38:53 -07:00
rbalsleyMSFT c946e56a41 Refactors CU checkbox initialization logic
Moves the initial state logic for the "Latest CU" and "Preview CU" checkboxes from the main UI script to the core initialization module.

This change centralizes UI default settings into the `Initialize-UIDefaults` function, improving code organization and maintainability.
2025-06-19 18:12:06 -07:00
rbalsleyMSFT cbc9ec4634 Refactor: Remove Office UI logic from load event
Removes the logic for managing the visibility of Office installation options from the window's loaded event handler.

This change centralizes UI state management within dedicated event handlers, simplifying the initial UI setup.
2025-06-19 16:40:13 -07:00
rbalsleyMSFT 094e084316 Refactor and centralize UI panel visibility logic
Consolidates the logic for showing and hiding UI elements into dedicated functions, `Update-DriverDownloadPanelVisibility` and `Update-OfficePanelVisibility`.

This change simplifies the event handlers for the "Download Drivers" checkbox by using a single handler for both checked and unchecked states. It also moves the initial UI setup from the main script into the core initialization module, improving code organization and reducing duplication.
2025-06-19 16:37:32 -07:00
rbalsleyMSFT 52085cf521 Refactor Apps Script Variables UI logic
Extracts inline event handler logic for managing Apps Script Variables from the main UI script into new functions within the `FFUUI.Core.Applications` module.

This change improves code organization and maintainability by centralizing the logic for adding and removing variables. The event handlers are updated to call these new, dedicated functions.
2025-06-19 16:11:40 -07:00
rbalsleyMSFT a4e9b70b27 Refactor: Centralize driver checkbox event handling
Moves the interdependent state logic for the driver-related checkboxes from the main UI script into a new, centralized function within the core module.

This change simplifies the event handling by using a single handler for all related checkboxes, which improves code readability and maintainability. The new function is also called during initialization to ensure the UI reflects the correct state on startup.
2025-06-19 15:42:57 -07:00
rbalsleyMSFT 2cfd947429 Refactor UI event handlers into core module
Moves the 'Browse' button click event handlers from the main UI script into the core handlers module.

This change improves code organization and separation of concerns. The handlers are updated to be more self-contained by retrieving state from the event source rather than relying on a global state variable, which improves modularity.
2025-06-19 15:31:00 -07:00
rbalsleyMSFT 24ed20305f Refactor: Decouple BYO Apps UI logic into core modules
Moves the event handling and business logic for the "Bring Your Own Applications" feature from the main UI script into dedicated core modules.

This change improves code organization and separation of concerns by centralizing application-related functions and their corresponding event handlers. The main UI script is now cleaner and primarily responsible for UI initialization, enhancing overall code maintainability.
2025-06-19 15:19:35 -07:00
rbalsleyMSFT 12607cca44 Refactor: Move Winget download logic to core module
Extracts the Winget app download logic from the main UI script into a new `Invoke-WingetDownload` function within the core Winget module.

This change decouples the UI event handling from the business logic, improving modularity and maintainability. It also introduces more robust error handling for the download process by wrapping the logic in a try/catch block.
2025-06-19 12:23:13 -07:00
rbalsleyMSFT 00ee79d33c Style: Remove extraneous blank lines
Improves code readability by removing unnecessary whitespace.
2025-06-19 12:16:55 -07:00
rbalsleyMSFT d7d0cb3a06 Refactor: Centralize UI event handlers and abstract list clearing
Moves UI event handling logic from the main script into a dedicated core module to improve separation of concerns.

Introduces a new shared function, `Clear-ListViewContent`, to consolidate duplicated logic for clearing list views. This generic function handles user confirmation, data source clearing, and UI updates for multiple tabs, significantly reducing code redundancy.
2025-06-19 12:11:57 -07:00
rbalsleyMSFT ec8ce1f2f6 Refactor: Move application tab event handlers to core module
Relocates the event handling logic for the "Applications" tab from the main UI script into the `FFUUI.Core.Handlers` module.

This improves code organization and modularity by centralizing UI logic. The handlers are also updated to use local state instead of a global variable.
2025-06-19 11:00:14 -07:00
rbalsleyMSFT f7f78da1a1 Chore: Remove unnecessary comment
Removes a redundant comment from the UI script to improve code readability.
2025-06-18 17:31:47 -07:00
rbalsleyMSFT 49b0772076 Refactor USB drive UI logic into core modules
Moves event handlers and initial state configuration for the USB drive creation settings from the main UI script into the core handler and initialization modules.

This change centralizes the UI logic, improving code organization and maintainability.
2025-06-18 17:30:23 -07:00
rbalsleyMSFT f44e06c57e Refactor USB drive list with dynamic selection and sorting
Updates the USB drive selection UI to align with other list views in the application. This change replaces the static "Select All" checkbox with a dynamic, selectable column that includes the checkbox in the header.

This refactoring provides a more consistent user experience and adds column sorting functionality to the USB drive list.

Additionally, the underlying shared function for creating selectable columns is improved to use the central UI state object for managing controls, removing the dependency on script-scoped variables for better encapsulation.
2025-06-18 16:10:15 -07:00
rbalsleyMSFT b46b904504 Refactor USB drive event handlers to core module
Moves the event handling logic for the USB drive selection controls from the main UI script to the `FFUUI.Core.Handlers` module.

This change improves code organization by centralizing UI logic. The handlers were also improved to correctly manage the "Select All" checkbox state.
2025-06-18 13:52:25 -07:00
rbalsleyMSFT 004b42436e Refactor USB drive detection event handler
Moves the click event handler for detecting USB drives from the main UI script to the dedicated core handlers module.

This change centralizes UI logic, improving code organization and maintainability.
2025-06-18 13:24:38 -07:00
rbalsleyMSFT 5e5db62d2a Refactors CU checkbox logic to core handlers
Moves the event handling logic for the "Latest CU" and "Preview CU" checkboxes from the main UI script into the core handlers module.

This change centralizes UI event handling, improving code organization and maintainability. The new implementation is also more robust, accessing state via the window's `Tag` property rather than a global script variable.
2025-06-18 13:16:34 -07:00
rbalsleyMSFT fd39b0008e Refactor: Centralize Install Apps checkbox logic
Consolidates the state management for the "Install Apps" checkbox into a single, reusable function.

Previously, the logic to automatically check and disable "Install Apps" when selecting an update or installing Office was duplicated and scattered across multiple event handlers and files.

This change introduces a new core function that centralizes this behavior. A single event handler is now used for all relevant checkboxes (Updates and Office), simplifying the UI code, reducing redundancy, and making the logic more robust and maintainable. The initial state is also set correctly on startup.
2025-06-18 13:07:07 -07:00
rbalsleyMSFT af5d5206f8 Refactors Office UI event handlers into core module
Moves the event handling logic for the M365 Apps/Office options from the main UI script into the `FFUUI.Core.Handlers` module.

This change centralizes UI event handling, improving code organization and maintainability. It also decouples the handlers from the main script by using a local state object instead of a global script variable.
2025-06-17 22:55:42 -07:00
rbalsleyMSFT 6bf38d369b Improves code formatting
Adds a blank line to improve readability by separating UI state initialization logic.
2025-06-17 18:34:00 -07:00
rbalsleyMSFT 87c9bc769e 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.
2025-06-17 18:25:06 -07:00
rbalsleyMSFT f014d7ffcd Refactor: Move driver download logic to core module
Relocates the click event handler for the driver download button from the main UI script to the `FFUUI.Core` module.

This change centralizes UI logic within the core module, improving code organization and maintainability. The handler is updated to use the local window state object instead of global script variables.
2025-06-17 16:18:38 -07:00
rbalsleyMSFT 07306ff209 Refactors model filter event handling to core module
Moves the `TextChanged` event handler for the driver model filter from the UI script to the core `Register-EventHandlers` function.

This change centralizes the logic and makes the handler more generic by retrieving the UI state from the window's tag instead of relying on a global variable.
2025-06-17 16:11:18 -07:00
rbalsleyMSFT ab0b92ad5c Refactor Dell driver catalog download logic
Moves the logic for downloading and preparing the Dell driver catalog from the main build scripts directly into the specific Dell driver download task.

This change encapsulates all Dell-specific logic within the `Save-DellDriversTask` function, making it self-sufficient. Each parallel task now manages its own dependency on the catalog file, which simplifies the main script's responsibilities.

Also includes minor code style formatting.
2025-06-17 16:02:34 -07:00
rbalsleyMSFT df96d14643 Clean up comments in build UI script
Removes several obsolete or redundant comments to improve code readability.
2025-06-17 15:52:58 -07:00