fix logic

This commit is contained in:
MyDrift 2024-08-25 17:32:30 +02:00
parent b02294daf9
commit 5621b50762
5 changed files with 17 additions and 10 deletions

View File

@ -3091,8 +3091,8 @@
"panel": "1", "panel": "1",
"Order": "a002_", "Order": "a002_",
"InvokeScript": [ "InvokeScript": [
"Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse "Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse" Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue"
], ],
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DeleteTempFiles" "link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DeleteTempFiles"
}, },

View File

@ -18,12 +18,14 @@ function Invoke-WPFFeatureInstall {
if ($FeatureConfig) { if ($FeatureConfig) {
$Features = $FeatureConfig $Features = $FeatureConfig
$automation = $true
} else { } else {
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"] $Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
$automation = $false
} }
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $Features, $automation -DebugPreference $DebugPreference -ScriptBlock {
param($Features, $DebugPreference) param($Features, $automation, $DebugPreference)
$sync.ProcessRunning = $true $sync.ProcessRunning = $true
if ($Features.count -eq 1) { if ($Features.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })

View File

@ -18,8 +18,10 @@ function Invoke-WPFInstall {
if ($InstallConfig) { if ($InstallConfig) {
$PackagesToInstall = $InstallConfig $PackagesToInstall = $InstallConfig
$automation = $true
} else { } else {
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"] $PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
$automation = $false
} }
if ($PackagesToInstall.Count -eq 0) { if ($PackagesToInstall.Count -eq 0) {
@ -29,8 +31,8 @@ function Invoke-WPFInstall {
} }
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $automation -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToInstall, $DebugPreference) param($PackagesToInstall, $automation, $DebugPreference)
if ($PackagesToInstall.count -eq 1) { if ($PackagesToInstall.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
} else { } else {

View File

@ -22,10 +22,11 @@ function Invoke-WPFRunspace {
Param ( Param (
$ScriptBlock, $ScriptBlock,
$ArgumentList, $ArgumentList,
$DebugPreference $DebugPreference,
$automation
) )
if ($PARAM_RUN) { if ($automation = $true) {
& $ScriptBlock @ArgumentList @DebugPreference & $ScriptBlock @ArgumentList @DebugPreference
} else { } else {
# Create a PowerShell instance # Create a PowerShell instance

View File

@ -18,8 +18,10 @@ function Invoke-WPFtweaksbutton {
if ($TweaksConfig) { if ($TweaksConfig) {
$Tweaks = $TweaksConfig $Tweaks = $TweaksConfig
$automation = $true
} else { } else {
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"] $Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
$automation = $false
} }
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
@ -32,8 +34,8 @@ function Invoke-WPFtweaksbutton {
Write-Debug "Number of tweaks to process: $($Tweaks.Count)" Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $Tweaks, $automation -DebugPreference $DebugPreference -ScriptBlock {
param($Tweaks, $DebugPreference) param($Tweaks, $automation, $DebugPreference)
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)" Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
$sync.ProcessRunning = $true $sync.ProcessRunning = $true