Files
winutil/functions/public/Invoke-WPFInstall.ps1
T

44 lines
1.5 KiB
PowerShell
Raw Normal View History

+3
2023-03-07 12:28:00 -08:00
function Invoke-WPFInstall {
<#
2023-10-19 17:12:55 -05:00
.SYNOPSIS
Installs the selected programs using winget
+3
2023-03-07 12:28:00 -08:00
#>
if($sync.ProcessRunning){
2024-01-15 11:32:19 -06:00
$msg = "[Invoke-WPFInstall] Install process is currently running."
+3
2023-03-07 12:28:00 -08:00
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return
}
2024-01-15 11:32:19 -06:00
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
+3
2023-03-07 12:28:00 -08:00
if ($wingetinstall.Count -eq 0) {
$WarningMsg = "Please select the program(s) to install"
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return
}
+19
2024-01-30 12:36:38 -06:00
Invoke-WPFRunspace -ArgumentList $WingetInstall -DebugPreference $DebugPreference -ScriptBlock {
2024-01-15 11:32:19 -06:00
param($WingetInstall, $DebugPreference)
+3
2023-03-07 12:28:00 -08:00
try{
$sync.ProcessRunning = $true
Install-WinUtilWinget
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall
Write-Host "==========================================="
Write-Host "-- Installs have finished ---"
Write-Host "==========================================="
}
Catch {
Write-Host "==========================================="
2024-02-07 18:11:40 -06:00
Write-Host "Error: $_"
+3
2023-03-07 12:28:00 -08:00
Write-Host "==========================================="
}
2024-01-15 11:32:19 -06:00
Start-Sleep -Seconds 5
+3
2023-03-07 12:28:00 -08:00
$sync.ProcessRunning = $False
}
}