mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-03 03:23:31 -05:00
use Dispatcher.Invoke
This commit is contained in:
@ -29,10 +29,10 @@ function Invoke-WPFUnInstall {
|
||||
|
||||
if($confirm -eq "No"){return}
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Normal" -value 1/$PackagesToInstall.Count
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
# $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 1/$using:PackagesToInstall.Count })
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
@ -68,13 +68,13 @@ function Invoke-WPFUnInstall {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Uninstalls have finished ---"
|
||||
Write-Host "==========================================="
|
||||
# Set-WinUtilTaskbaritem -state "None"
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" })
|
||||
}
|
||||
Catch {
|
||||
Write-Host "==========================================="
|
||||
Write-Host "Error: $_"
|
||||
Write-Host "==========================================="
|
||||
# Set-WinUtilTaskbaritem -state "Error"
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
||||
}
|
||||
$sync.ProcessRunning = $False
|
||||
}
|
||||
|
Reference in New Issue
Block a user