mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 18:42:35 -05:00
add function to manage taskbar item
changed from manually setting the taskbar overlay, progressvalue and progress state to setting them through a function
This commit is contained in:
@ -24,7 +24,7 @@ function Invoke-WPFGetInstalled {
|
||||
param($checkbox, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
if($checkbox -eq "winget"){
|
||||
Write-Host "Getting Installed Programs..."
|
||||
@ -43,6 +43,6 @@ function Invoke-WPFGetInstalled {
|
||||
|
||||
Write-Host "Done..."
|
||||
$sync.ProcessRunning = $false
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
Set-WinUtilTaskbaritem -state "None"
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ function Invoke-WPFGetIso {
|
||||
$sync.BusyMessage.Visibility="Visible"
|
||||
$sync.BusyText.Text="N Busy"
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
|
||||
|
||||
Write-Host " _ __ __ _ "
|
||||
@ -90,6 +89,8 @@ function Invoke-WPFGetIso {
|
||||
return
|
||||
}
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
# Detect the file size of the ISO and compare it with the free space of the system drive
|
||||
$isoSize = (Get-Item -Path $filePath).Length
|
||||
Write-Debug "Size of ISO file: $($isoSize) bytes"
|
||||
@ -241,7 +242,7 @@ function Invoke-WPFGetIso {
|
||||
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
$sync.ProcessRunning = $false
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
Set-WinUtilTaskbaritem -state "None"
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,10 +20,10 @@ function Invoke-WPFInstall {
|
||||
return
|
||||
}
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Normal"
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
Set-WinUtilTaskbaritem -state "Normal" -value 1/$PackagesToInstall.Count
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
@ -54,13 +54,13 @@ function Invoke-WPFInstall {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Installs have finished ---"
|
||||
Write-Host "==========================================="
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
# Set-WinUtilTaskbaritem -state "None"
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
||||
# Set-WinUtilTaskbaritem -state "Error"
|
||||
}
|
||||
Start-Sleep -Seconds 5
|
||||
$sync.ProcessRunning = $False
|
||||
|
@ -4,7 +4,6 @@ function Invoke-WPFMicrowin {
|
||||
Invoke MicroWin routines...
|
||||
#>
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
|
||||
if($sync.ProcessRunning) {
|
||||
$msg = "GetIso process is currently running."
|
||||
@ -44,6 +43,8 @@ public class PowerManagement {
|
||||
return
|
||||
}
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
Write-Host "Target ISO location: $($SaveDialog.FileName)"
|
||||
|
||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||
@ -479,6 +480,6 @@ public class PowerManagement {
|
||||
# Allow the machine to sleep again (optional)
|
||||
[PowerManagement]::SetThreadExecutionState(0)
|
||||
$sync.ProcessRunning = $false
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "None"
|
||||
Set-WinUtilTaskbaritem -state "None"
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
if($confirm -eq "No"){return}
|
||||
|
||||
$sync["Form"].taskbarItemInfo.ProgressState = "Normal"
|
||||
Set-WinUtilTaskbaritem -state "Normal" -value 1/$PackagesToInstall.Count
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
@ -68,13 +68,13 @@ function Invoke-WPFUnInstall {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Uninstalls have finished ---"
|
||||
Write-Host "==========================================="
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "Indeterminate"
|
||||
# Set-WinUtilTaskbaritem -state "None"
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
# $sync["Form"].taskbarItemInfo.ProgressState = "Error"
|
||||
# Set-WinUtilTaskbaritem -state "Error"
|
||||
}
|
||||
$sync.ProcessRunning = $False
|
||||
}
|
||||
|
Reference in New Issue
Block a user