mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 02:22:34 -05:00
Add Progress bar to some stuff
https://learn.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo?view=windowsdesktop-8.0
This commit is contained in:
@ -14,15 +14,19 @@ function Install-WinUtilChoco {
|
||||
return
|
||||
}
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
|
||||
Write-Host "Seems Chocolatey is not installed, installing now."
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
||||
powershell choco feature enable -n allowGlobalConfirmation
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
|
||||
}
|
||||
Catch {
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
Write-Host "-- Chocolatey failed to install ---" -Foregroundcolor Red
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ function Install-WinUtilProgramChoco {
|
||||
}
|
||||
}
|
||||
$x++
|
||||
# $sync["Form"].TaskbarItemInfo.ProgressValue = $x/$count
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
|
||||
|
@ -97,6 +97,7 @@ Function Install-WinUtilProgramWinget {
|
||||
}
|
||||
}
|
||||
$X++
|
||||
# $sync["Form"].TaskbarItemInfo.ProgressValue = $x/$count
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
return $failedPackages;
|
||||
|
@ -19,6 +19,8 @@ function Install-WinUtilWinget {
|
||||
Write-Host "`nWinget is not Installed. Continuing with install.`r" -ForegroundColor Red
|
||||
}
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
|
||||
# Gets the computer's information
|
||||
if ($null -eq $sync.ComputerInfo){
|
||||
$ComputerInfo = Get-ComputerInfo -ErrorAction Stop
|
||||
@ -63,4 +65,5 @@ function Install-WinUtilWinget {
|
||||
throw [WingetFailedInstall]::new('Failed to install!')
|
||||
}
|
||||
}
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
}
|
||||
|
@ -10,6 +10,9 @@ function Invoke-WinUtilFeatureInstall {
|
||||
$CheckBox
|
||||
)
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Normal"
|
||||
$sync["Form"].taskbarItemInfo.ProgressValue = 1 # Get amount of affected features & scripts
|
||||
|
||||
$CheckBox | ForEach-Object {
|
||||
if($sync.configs.feature.$psitem.feature){
|
||||
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
||||
@ -23,6 +26,7 @@ function Invoke-WinUtilFeatureInstall {
|
||||
}
|
||||
|
||||
else{
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
@ -43,6 +47,7 @@ function Invoke-WinUtilFeatureInstall {
|
||||
}
|
||||
|
||||
else{
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
||||
Write-Warning "Unable to Install $feature due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
@ -50,4 +55,7 @@ function Invoke-WinUtilFeatureInstall {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sync["Form"].taskbarItemInfo.ProgressState -ne "Error"){
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user