Files
winutil/functions/private/Set-WinUtilProgressbar.ps1
T

25 lines
877 B
PowerShell
Raw Normal View History

function Set-WinUtilProgressbar{
<#
.SYNOPSIS
2024-08-06 15:50:36 -05:00
This function is used to Update the Progress Bar displayed in the winutil GUI.
It will be automatically hidden if the user clicks something and no process is running
.PARAMETER Label
2025-10-14 19:51:53 +02:00
The Text to be overlaid onto the Progress Bar
.PARAMETER PERCENT
2024-08-06 15:50:36 -05:00
The percentage of the Progress Bar that should be filled (0-100)
#>
param(
[string]$Label,
[ValidateRange(0,100)]
[int]$Percent
)
$sync.form.Dispatcher.Invoke([action]{$sync.progressBarTextBlock.Text = $label})
$sync.form.Dispatcher.Invoke([action]{$sync.progressBarTextBlock.ToolTip = $label})
if ($percent -lt 5 ) {
$percent = 5 # Ensure the progress bar is not empty, as it looks weird
}
$sync.form.Dispatcher.Invoke([action]{ $sync.ProgressBar.Value = $percent})
2024-08-06 15:50:36 -05:00
}