mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
Replace install progress overlay with shared indicator (#4844)
* Use shared progress for app workflows * Remove legacy install progress overlay * Document shared app progress indicator * Address progress review feedback * Track all Win11 ISO progress * Restore Win11 Creator work on relaunch
This commit is contained in:
@@ -47,7 +47,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
}
|
||||
|
||||
Write-Win11ISOLog "Mounting ISO: $isoPath"
|
||||
Set-WinUtilProgressBar -Label "Mounting ISO..." -Percent 10
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Mounting ISO..." -Percent 10
|
||||
|
||||
try {
|
||||
Mount-DiskImage -ImagePath $isoPath
|
||||
@@ -59,7 +59,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
$driveLetter = (Get-DiskImage -ImagePath $isoPath | Get-Volume).DriveLetter + ":"
|
||||
Write-Win11ISOLog "Mounted at drive $driveLetter"
|
||||
|
||||
Set-WinUtilProgressBar -Label "Verifying ISO contents..." -Percent 30
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Verifying ISO contents..." -Percent 30
|
||||
|
||||
$wimPath = Join-Path $driveLetter "sources\install.wim"
|
||||
$esdPath = Join-Path $driveLetter "sources\install.esd"
|
||||
@@ -70,13 +70,13 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
[System.Windows.MessageBox]::Show(
|
||||
"This does not appear to be a valid Windows ISO.`n`ninstall.wim / install.esd was not found.",
|
||||
"Invalid ISO", "OK", "Error")
|
||||
Set-WinUtilProgressBar -Label "" -Percent 0
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $false
|
||||
return
|
||||
}
|
||||
|
||||
$activeWim = if (Test-Path $wimPath) { $wimPath } else { $esdPath }
|
||||
|
||||
Set-WinUtilProgressBar -Label "Reading image metadata..." -Percent 55
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Reading image metadata..." -Percent 55
|
||||
$imageInfo = Get-WindowsImage -ImagePath $activeWim | Select-Object ImageIndex, ImageName
|
||||
|
||||
if (-not ($imageInfo | Where-Object { $_.ImageName -match "Windows 11" })) {
|
||||
@@ -85,7 +85,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
[System.Windows.MessageBox]::Show(
|
||||
"No Windows 11 edition was found in this ISO.`n`nOnly official Windows 11 ISOs are supported.",
|
||||
"Not a Windows 11 ISO", "OK", "Error")
|
||||
Set-WinUtilProgressBar -Label "" -Percent 0
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
$sync["Win11ISOImagePath"] = $isoPath
|
||||
$sync["WPFWin11ISOModifySection"].Visibility = "Visible"
|
||||
|
||||
Set-WinUtilProgressBar -Label "ISO verified" -Percent 100
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $true -Label "ISO verified" -Percent 100
|
||||
Write-Win11ISOLog "ISO verified OK. Editions found: $($imageInfo.Count)"
|
||||
} catch {
|
||||
Write-Win11ISOLog "ERROR during mount/verify: $_"
|
||||
@@ -123,7 +123,7 @@ function Invoke-WinUtilISOMountAndVerify {
|
||||
"Error", "OK", "Error")
|
||||
} finally {
|
||||
Start-Sleep -Milliseconds 800
|
||||
Set-WinUtilProgressBar -Label "" -Percent 0
|
||||
Set-WinUtilTweaksProgressIndicator -Visible $false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ function Invoke-WinUtilISOModify {
|
||||
|
||||
$sync["WPFWin11ISOModifyButton"].IsEnabled = $false
|
||||
$sync["Win11ISOModifying"] = $true
|
||||
$sync["Win11ISOProcessRunning"] = $true
|
||||
|
||||
$workDir = Join-Path $env:TEMP "WinUtil_Win11ISO_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
|
||||
if (Test-Path $workDir) {
|
||||
@@ -203,9 +204,10 @@ function Invoke-WinUtilISOModify {
|
||||
|
||||
function SetProgress($label, $pct) {
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = $label
|
||||
$sync.progressBarTextBlock.ToolTip = $label
|
||||
$sync.ProgressBar.Value = [Math]::Max($pct, 5)
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Visible"
|
||||
$sync["WPFTweaksProgressLabel"].Text = $label
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = $label
|
||||
$sync["WPFTweaksProgressValue"].Value = [Math]::Max($pct, 5)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -452,10 +454,12 @@ function Invoke-WinUtilISOModify {
|
||||
} finally {
|
||||
Start-Sleep -Milliseconds 800
|
||||
$sync["Win11ISOModifying"] = $false
|
||||
$sync["Win11ISOProcessRunning"] = $false
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = ""
|
||||
$sync.progressBarTextBlock.ToolTip = ""
|
||||
$sync.ProgressBar.Value = 0
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Collapsed"
|
||||
$sync["WPFTweaksProgressLabel"].Text = ""
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = ""
|
||||
$sync["WPFTweaksProgressValue"].Value = 0
|
||||
$sync["WPFWin11ISOModifyButton"].IsEnabled = $true
|
||||
if ($sync["WPFWin11ISOOutputSection"].Visibility -ne "Visible") {
|
||||
$sync["WPFWin11ISOSelectSection"].Visibility = "Visible"
|
||||
@@ -514,6 +518,7 @@ function Invoke-WinUtilISOCleanAndReset {
|
||||
}
|
||||
|
||||
$sync["WPFWin11ISOCleanResetButton"].IsEnabled = $false
|
||||
$sync["Win11ISOProcessRunning"] = $true
|
||||
|
||||
$runspace = [Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
|
||||
$runspace.ApartmentState = "STA"
|
||||
@@ -538,9 +543,10 @@ function Invoke-WinUtilISOCleanAndReset {
|
||||
|
||||
function SetProgress($label, $pct) {
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = $label
|
||||
$sync.progressBarTextBlock.ToolTip = $label
|
||||
$sync.ProgressBar.Value = [Math]::Max($pct, 5)
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Visible"
|
||||
$sync["WPFTweaksProgressLabel"].Text = $label
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = $label
|
||||
$sync["WPFTweaksProgressValue"].Value = [Math]::Max($pct, 5)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -628,20 +634,24 @@ function Invoke-WinUtilISOCleanAndReset {
|
||||
$sync["WPFWin11ISOModifyButton"].IsEnabled = $true
|
||||
$sync["WPFWin11ISOCleanResetButton"].IsEnabled = $true
|
||||
|
||||
$sync.progressBarTextBlock.Text = ""
|
||||
$sync.progressBarTextBlock.ToolTip = ""
|
||||
$sync.ProgressBar.Value = 0
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Collapsed"
|
||||
$sync["WPFTweaksProgressLabel"].Text = ""
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = ""
|
||||
$sync["WPFTweaksProgressValue"].Value = 0
|
||||
|
||||
$sync["WPFWin11ISOStatusLog"].Text = "Ready. Please select a Windows 11 ISO to begin."
|
||||
})
|
||||
} catch {
|
||||
Log "ERROR during Clean & Reset: $_"
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = ""
|
||||
$sync.progressBarTextBlock.ToolTip = ""
|
||||
$sync.ProgressBar.Value = 0
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Collapsed"
|
||||
$sync["WPFTweaksProgressLabel"].Text = ""
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = ""
|
||||
$sync["WPFTweaksProgressValue"].Value = 0
|
||||
$sync["WPFWin11ISOCleanResetButton"].IsEnabled = $true
|
||||
})
|
||||
} finally {
|
||||
$sync["Win11ISOProcessRunning"] = $false
|
||||
}
|
||||
})
|
||||
|
||||
@@ -706,6 +716,7 @@ function Invoke-WinUtilISOExport {
|
||||
}
|
||||
|
||||
$sync["WPFWin11ISOChooseISOButton"].IsEnabled = $false
|
||||
$sync["Win11ISOProcessRunning"] = $true
|
||||
|
||||
$runspace = [Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
|
||||
$runspace.ApartmentState = "STA"
|
||||
@@ -726,9 +737,10 @@ function Invoke-WinUtilISOExport {
|
||||
|
||||
function SetProgress($label, $pct) {
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = $label
|
||||
$sync.progressBarTextBlock.ToolTip = $label
|
||||
$sync.ProgressBar.Value = [Math]::Max($pct, 5)
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Visible"
|
||||
$sync["WPFTweaksProgressLabel"].Text = $label
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = $label
|
||||
$sync["WPFTweaksProgressValue"].Value = [Math]::Max($pct, 5)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -788,10 +800,12 @@ function Invoke-WinUtilISOExport {
|
||||
})
|
||||
} finally {
|
||||
Start-Sleep -Milliseconds 800
|
||||
$sync["Win11ISOProcessRunning"] = $false
|
||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
||||
$sync.progressBarTextBlock.Text = ""
|
||||
$sync.progressBarTextBlock.ToolTip = ""
|
||||
$sync.ProgressBar.Value = 0
|
||||
$sync["WPFTweaksProgressBar"].Visibility = "Collapsed"
|
||||
$sync["WPFTweaksProgressLabel"].Text = ""
|
||||
$sync["WPFTweaksProgressLabel"].ToolTip = ""
|
||||
$sync["WPFTweaksProgressValue"].Value = 0
|
||||
$sync["WPFWin11ISOChooseISOButton"].IsEnabled = $true
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user