mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-03 19:44:55 -06:00
14d6d07dc7
* Add the argument '--accept-source-agreements' to the Uninstall command of Winget Added '--accept-source-agreements' to insure that the Package Uninstall process is completely unattended. * Improve the Wording of the 'WPFInstall' function and 'inputXML.xaml' file
45 lines
1.6 KiB
PowerShell
45 lines
1.6 KiB
PowerShell
function Invoke-WPFInstall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Installs the selected programs using winget, if one or more of the selected programs are already installed on the system, winget will try and perform an upgrade if there's a newer version to install.
|
|
|
|
#>
|
|
|
|
if($sync.ProcessRunning){
|
|
$msg = "[Invoke-WPFInstall] An Install process is currently running."
|
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
return
|
|
}
|
|
|
|
$WingetInstall = (Get-WinUtilCheckBoxes)["Install"]
|
|
|
|
if ($wingetinstall.Count -eq 0) {
|
|
$WarningMsg = "Please select the program(s) to install or upgrade"
|
|
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
return
|
|
}
|
|
|
|
Invoke-WPFRunspace -ArgumentList $WingetInstall -DebugPreference $DebugPreference -ScriptBlock {
|
|
param($WingetInstall, $DebugPreference)
|
|
|
|
try{
|
|
$sync.ProcessRunning = $true
|
|
|
|
Install-WinUtilWinget
|
|
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall
|
|
|
|
Write-Host "==========================================="
|
|
Write-Host "-- Installs have finished ---"
|
|
Write-Host "==========================================="
|
|
}
|
|
Catch {
|
|
Write-Host "==========================================="
|
|
Write-Host "Error: $_"
|
|
Write-Host "==========================================="
|
|
}
|
|
Start-Sleep -Seconds 5
|
|
$sync.ProcessRunning = $False
|
|
}
|
|
}
|