mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 14:01:31 -06:00
e7328c2739
* Compile Winutil * first draft for Progress bar in GUI * small optimizations to the loading bar * Optimize the Winget Installation Function to make it more maintainable * Apply loading bar to Tweaks * Update colors * Add docs * Fix value range for the taskbar item * Remove winutil.ps1 from PR * Documention and fix an oversight in the uninstall logic * Reduce even more repeaded code --------- Co-authored-by: Marterich <Marterich@users.noreply.github.com>
31 lines
1.3 KiB
PowerShell
31 lines
1.3 KiB
PowerShell
function Set-WinUtilProgressbar{
|
|
<#
|
|
.SYNOPSIS
|
|
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
|
|
The Text to be overlayed onto the Progress Bar
|
|
.PARAMETER PERCENT
|
|
The percentage of the Progress Bar that should be filled (0-100)
|
|
.PARAMETER Hide
|
|
If provided, the Progress Bar and the label will be hidden
|
|
#>
|
|
param(
|
|
[string]$Label,
|
|
[ValidateRange(0,100)]
|
|
[int]$Percent,
|
|
$Hide
|
|
)
|
|
if ($hide){
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Collapsed"})
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Collapsed"})
|
|
}
|
|
else{
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Visibility = "Visible"})
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBar.Visibility = "Visible"})
|
|
}
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.Text = $label})
|
|
$sync.form.Dispatcher.Invoke([action]{$sync.ProgressBarLabel.Content.ToolTip = $label})
|
|
$sync.form.Dispatcher.Invoke([action]{ $sync.ProgressBar.Value = $percent})
|
|
|
|
} |