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.
This commit is contained in:
rbalsleyMSFT
2025-06-19 12:11:57 -07:00
parent ec8ce1f2f6
commit d7d0cb3a06
4 changed files with 238 additions and 100 deletions
@@ -686,6 +686,19 @@ function Start-WingetAppDownloadTask {
return $returnObject
}
function Update-WingetVersionFields {
param(
[psobject]$State,
[string]$wingetText,
[string]$moduleText
)
$State.Window.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Normal, [Action] {
$State.Controls.txtWingetVersion.Text = $wingetText
$State.Controls.txtWingetModuleVersion.Text = $moduleText
[System.Windows.Forms.Application]::DoEvents()
})
}
# --------------------------------------------------------------------------
# SECTION: Module Export
# --------------------------------------------------------------------------