mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-16 23:55:50 -06:00
58 lines
2.2 KiB
PowerShell
58 lines
2.2 KiB
PowerShell
|
function Invoke-WPFUnInstall {
|
||
|
<#
|
||
|
|
||
|
.DESCRIPTION
|
||
|
PlaceHolder
|
||
|
|
||
|
#>
|
||
|
|
||
|
if($sync.ProcessRunning){
|
||
|
$msg = "Install process is currently running."
|
||
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
$WingetInstall = Get-WinUtilCheckBoxes -Group "WPFInstall"
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
$ButtonType = [System.Windows.MessageBoxButton]::YesNo
|
||
|
$MessageboxTitle = "Are you sure?"
|
||
|
$Messageboxbody = ("This will uninstall the following applications `n $WingetInstall")
|
||
|
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||
|
|
||
|
$confirm = [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||
|
|
||
|
if($confirm -eq "No"){return}
|
||
|
|
||
|
Invoke-WPFRunspace -ArgumentList $WingetInstall -scriptblock {
|
||
|
param($WingetInstall)
|
||
|
try{
|
||
|
$sync.ProcessRunning = $true
|
||
|
|
||
|
# Install all winget programs in new window
|
||
|
Install-WinUtilProgramWinget -ProgramsToInstall $WingetInstall -Manage "Uninstalling"
|
||
|
|
||
|
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
||
|
$MessageboxTitle = "Uninstalls are Finished "
|
||
|
$Messageboxbody = ("Done")
|
||
|
$MessageIcon = [System.Windows.MessageBoxImage]::Information
|
||
|
|
||
|
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||
|
|
||
|
Write-Host "==========================================="
|
||
|
Write-Host "-- Uninstalls have finished ---"
|
||
|
Write-Host "==========================================="
|
||
|
}
|
||
|
Catch {
|
||
|
Write-Host "==========================================="
|
||
|
Write-Host "-- Winget failed to install ---"
|
||
|
Write-Host "==========================================="
|
||
|
}
|
||
|
$sync.ProcessRunning = $False
|
||
|
}
|
||
|
}
|