mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 14:01:31 -06:00
1032d3d5aa
* Add Progress bar to some stuff https://learn.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo?view=windowsdesktop-8.0 * add function to manage taskbar item changed from manually setting the taskbar overlay, progressvalue and progress state to setting them through a function * add description feature * use Dispatcher.Invoke * restructure, fix, additions * fix merge conflicts * add check to progresses * remove progress from wiget & choco install * fix * polish * fix * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix syntax * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * rework - add overlay presets - rework image saving & converting - removed popup after uninstalling applications * fix description of function * undo winutil * remove check.png * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * Update functions/private/Set-WinUtilTaskbarItem.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * rework assets directory & its usage * fixes - ability to set no overlay added - added relative path to winutildir * hotfix * last fixes * add comment * remove trailing whitespaces THX to Mr.K :) * renamed checkmark & added warning * last fixes remove bitmap remove unneeded "| out-null" * hotfix for new commit --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com>
62 lines
2.3 KiB
PowerShell
62 lines
2.3 KiB
PowerShell
function Invoke-WinUtilFeatureInstall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Converts all the values from the tweaks.json and routes them to the appropriate function
|
|
|
|
#>
|
|
|
|
param(
|
|
$CheckBox
|
|
)
|
|
|
|
$x = 0
|
|
|
|
$CheckBox | ForEach-Object {
|
|
if($sync.configs.feature.$psitem.feature){
|
|
Foreach( $feature in $sync.configs.feature.$psitem.feature ){
|
|
Try{
|
|
Write-Host "Installing $feature"
|
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
|
|
}
|
|
Catch{
|
|
if ($psitem.Exception.Message -like "*requires elevation*"){
|
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
|
}
|
|
|
|
else{
|
|
|
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
|
Write-Warning $psitem.Exception.StackTrace
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if($sync.configs.feature.$psitem.InvokeScript){
|
|
Foreach( $script in $sync.configs.feature.$psitem.InvokeScript ){
|
|
Try{
|
|
$Scriptblock = [scriptblock]::Create($script)
|
|
|
|
Write-Host "Running Script for $psitem"
|
|
Invoke-Command $scriptblock -ErrorAction stop
|
|
}
|
|
Catch{
|
|
if ($psitem.Exception.Message -like "*requires elevation*"){
|
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
|
}
|
|
|
|
else{
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" })
|
|
Write-Warning "Unable to Install $feature due to unhandled exception"
|
|
Write-Warning $psitem.Exception.StackTrace
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$X++
|
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($x/$CheckBox.Count) })
|
|
}
|
|
}
|