mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
acc2b5b243
* Comment Spacing, Indentation, and Capitalization * Comment Grammar and Spacing Makes grammar in comments better and more consistent Adds space before comment and centers word in `Write-Host` commands * More Grammar and Formatting * Add some comments * Populate PlaceHolder comments in functions Files I found that has issues: Get-WinUtilRegistry.ps1 Install-WinUtilWinget.ps1 Invoke-WinUtilDarkMode.ps1 Remove-WinUtilAPPX.ps1 Test-WinUtilPackageManager.ps1 Update-WinUtilProgramWinget.ps1 Invoke-WPFUpdatessecurity.ps1 * Tweak a few more comments * Tweak another write-host statement * Undo Catch statement adjustment It's outside of the scope of this pull request
58 lines
2.2 KiB
PowerShell
58 lines
2.2 KiB
PowerShell
function Invoke-WPFUnInstall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Uninstalls the selected programs
|
|
|
|
#>
|
|
|
|
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 selected 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
|
|
}
|
|
} |