mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
feat: Add restore defaults and centralize cleanup logic
Introduces a "Restore Defaults" feature in the UI to reset the environment. This action removes generated configuration files, ISOs, downloaded apps, updates, drivers, and FFUs. The post-build cleanup logic is refactored from the main build script into a new common function. This new function is used by both the standard build process and the new restore defaults feature, promoting code reuse and simplifying maintenance.
This commit is contained in:
@@ -216,11 +216,11 @@ function Register-EventHandlers {
|
||||
}
|
||||
else {
|
||||
$localState.Controls.txtCustomVMSwitchName.Visibility = 'Collapsed'
|
||||
if ($localState.Data.vmSwitchMap.ContainsKey($selectedItem)) {
|
||||
if ($null -ne $selectedItem -and $localState.Data.vmSwitchMap.ContainsKey($selectedItem)) {
|
||||
$localState.Controls.txtVMHostIPAddress.Text = $localState.Data.vmSwitchMap[$selectedItem]
|
||||
}
|
||||
else {
|
||||
$localState.Controls.txtVMHostIPAddress.Text = '' # Clear IP if not found in map
|
||||
$localState.Controls.txtVMHostIPAddress.Text = '' # Clear IP if not found or key null
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -950,6 +950,12 @@ function Register-EventHandlers {
|
||||
$localState = $window.Tag
|
||||
Invoke-LoadConfiguration -State $localState
|
||||
})
|
||||
$State.Controls.btnRestoreDefaults.Add_Click({
|
||||
param($eventSource, $routedEventArgs)
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
$localState = $window.Tag
|
||||
Invoke-RestoreDefaults -State $localState
|
||||
})
|
||||
$State.Controls.btnBuildConfig.Add_Click({
|
||||
param($eventSource, $routedEventArgs)
|
||||
$window = [System.Windows.Window]::GetWindow($eventSource)
|
||||
|
||||
Reference in New Issue
Block a user