mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
feat: Add MaxUSBDrives parameter for parallel USB drive processing
- Introduced a new parameter `MaxUSBDrives` to control the maximum number of USB drives that can be built in parallel, with a default value of 5. - Updated UI to include a textbox for setting `MaxUSBDrives`. - Implemented validation to ensure the value is a non-negative integer. - Adjusted the deployment function to respect the `MaxUSBDrives` limit during USB drive creation.
This commit is contained in:
@@ -44,7 +44,8 @@ function Register-EventHandlers {
|
||||
$State.Controls.txtDiskSize,
|
||||
$State.Controls.txtMemory,
|
||||
$State.Controls.txtProcessors,
|
||||
$State.Controls.txtThreads
|
||||
$State.Controls.txtThreads,
|
||||
$State.Controls.txtMaxUSBDrives
|
||||
)
|
||||
|
||||
# Attach the handlers to each relevant textbox
|
||||
@@ -72,6 +73,20 @@ function Register-EventHandlers {
|
||||
})
|
||||
}
|
||||
|
||||
# Add specific validation for the Max USB Drives textbox to ensure it's an integer >=0 (allow 0 meaning all)
|
||||
if ($null -ne $State.Controls.txtMaxUSBDrives) {
|
||||
$State.Controls.txtMaxUSBDrives.Add_LostFocus({
|
||||
param($eventSource, $routedEventArgs)
|
||||
$textBox = $eventSource
|
||||
$currentValue = 0
|
||||
$isValidInteger = [int]::TryParse($textBox.Text, [ref]$currentValue)
|
||||
if (-not $isValidInteger -or $currentValue -lt 0) {
|
||||
$textBox.Text = '0'
|
||||
WriteLog "Max USB Drives value was invalid or less than 0. Reset to 0 (process all)."
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
# Build Tab Event Handlers
|
||||
$State.Controls.btnBrowseFFUDevPath.Add_Click({
|
||||
param($eventSource, $routedEventArgs)
|
||||
|
||||
Reference in New Issue
Block a user