mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
41 lines
1.4 KiB
PowerShell
41 lines
1.4 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
|
|
}
|
|
|
|
$handle = Invoke-WPFRunspace -ScriptBlock {
|
|
$Features = $sync.selectedFeatures
|
|
$sync.ProcessRunning = $true
|
|
if ($Features.count -eq 1) {
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }
|
|
} else {
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" }
|
|
}
|
|
|
|
$x = 0
|
|
|
|
$Features | ForEach-Object {
|
|
Invoke-WinUtilFeatureInstall $_
|
|
$X++
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -value ($x/$CheckBox.Count) }
|
|
}
|
|
|
|
$sync.ProcessRunning = $false
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" }
|
|
|
|
Write-Host "==================================="
|
|
Write-Host "--- Features are Installed ---"
|
|
Write-Host "--- A Reboot may be required ---"
|
|
Write-Host "==================================="
|
|
}
|
|
}
|