From 4958c5efe90d66169f178d5f2e9c9eb326dd9e20 Mon Sep 17 00:00:00 2001 From: Martin Wiethan <47688561+Marterich@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:10:16 +0200 Subject: [PATCH] Remove force install of Winget + Small improvements (#2083) * Compile Winutil * Add Run switch to Run winutil automatically after compilation * Remove Winutil ForceInstall and unnecessary loading bar --------- Co-authored-by: Marterich --- Compile.ps1 | 9 +++++++-- scripts/main.ps1 | 17 +++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Compile.ps1 b/Compile.ps1 index 8568e1af..c296eb7f 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -1,5 +1,6 @@ param ( - [switch]$Debug + [switch]$Debug, + [switch]$Run ) $OFS = "`r`n" $scriptname = "winutil.ps1" @@ -106,4 +107,8 @@ else { } Set-Content -Path $scriptname -Value ($script_content -join "`r`n") -Encoding ascii -Write-Progress -Activity "Compiling" -Completed \ No newline at end of file +Write-Progress -Activity "Compiling" -Completed + +if ($run){ + Start-Process -FilePath "powershell" -ArgumentList ".\$scriptname" +} \ No newline at end of file diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 6f603e46..572ecee4 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -133,9 +133,17 @@ $sync.keys | ForEach-Object { # Load computer information in the background Invoke-WPFRunspace -ScriptBlock { - $sync.ConfigLoaded = $False - $sync.ComputerInfo = Get-ComputerInfo - $sync.ConfigLoaded = $True + try{ + $oldProgressPreference = $ProgressPreference + $ProgressPreference = "SilentlyContinue" + $sync.ConfigLoaded = $False + $sync.ComputerInfo = Get-ComputerInfo + $sync.ConfigLoaded = $True + } + finally{ + $ProgressPreference = "Continue" + } + } | Out-Null #=========================================================================== @@ -145,9 +153,6 @@ Invoke-WPFRunspace -ScriptBlock { # Print the logo Invoke-WPFFormVariables -# Install Winget if not already present -Install-WinUtilWinget - # Set the titlebar $sync["Form"].title = $sync["Form"].title + " " + $sync.version # Set the commands that will run when the form is closed