mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-07 21:44:56 -06:00
37 lines
1.3 KiB
PowerShell
37 lines
1.3 KiB
PowerShell
function Invoke-WPFFeatureInstall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Installs selected Windows Features
|
|
|
|
#>
|
|
|
|
if($sync.ProcessRunning){
|
|
$msg = "[Invoke-WPFFeatureInstall] Install process is currently running."
|
|
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
|
return
|
|
}
|
|
|
|
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
|
|
|
|
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
|
|
param($Features, $DebugPreference)
|
|
$sync.ProcessRunning = $true
|
|
if ($Features.count -eq 1){
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
|
} else {
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
|
}
|
|
|
|
Invoke-WinUtilFeatureInstall $Features
|
|
|
|
$sync.ProcessRunning = $false
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
|
|
|
Write-Host "==================================="
|
|
Write-Host "--- Features are Installed ---"
|
|
Write-Host "--- A Reboot may be required ---"
|
|
Write-Host "==================================="
|
|
}
|
|
}
|