mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-06 07:50:10 +00:00
finish new install GUI
This commit is contained in:
@@ -38,25 +38,39 @@
|
||||
"Order": "2",
|
||||
"Description": "Use Chocolatey for package management"
|
||||
},
|
||||
"WPFCollapseAllCategories": {
|
||||
"Content": "Collapse All Categories",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "1",
|
||||
"Description": "Collapse all application categories"
|
||||
},
|
||||
"WPFExpandAllCategories": {
|
||||
"Content": "Expand All Categories",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "2",
|
||||
"Description": "Expand all application categories"
|
||||
},
|
||||
"WPFClearInstallSelection": {
|
||||
"Content": "Clear Selection",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "1",
|
||||
"Order": "3",
|
||||
"Description": "Clear the selection of applications"
|
||||
},
|
||||
"WPFGetInstalled": {
|
||||
"Content": "Get Installed",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "2",
|
||||
"Order": "4",
|
||||
"Description": "Show installed applications"
|
||||
},
|
||||
"WPFselectedAppsButton": {
|
||||
"Content": "Selected Apps: 0",
|
||||
"Category": "__Selection",
|
||||
"Type": "Button",
|
||||
"Order": "3",
|
||||
"Order": "5",
|
||||
"Description": "Show the selected applications"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
"AppInstallOverlayBackgroundColor":"#2E3135",
|
||||
"ComboBoxForegroundColor": "#F7F7F7",
|
||||
"ComboBoxBackgroundColor": "#1E3747",
|
||||
"LabelboxForegroundColor": "#0567ff",
|
||||
"LabelboxForegroundColor": "#5bdcff",
|
||||
"MainForegroundColor": "#F7F7F7",
|
||||
"MainBackgroundColor": "#232629",
|
||||
"LabelBackgroundColor": "#232629",
|
||||
|
||||
@@ -44,6 +44,7 @@ function Initialize-InstallCategoryAppList {
|
||||
$toggleButton.Tag = "CategoryToggleButton"
|
||||
$toggleButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "HeaderFontSize")
|
||||
$toggleButton.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily")
|
||||
$toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "LabelboxForegroundColor")
|
||||
$toggleButton.Cursor = [System.Windows.Input.Cursors]::Hand
|
||||
$toggleButton.HorizontalAlignment = [Windows.HorizontalAlignment]::Stretch
|
||||
$sync.$Category = $toggleButton
|
||||
|
||||
@@ -23,6 +23,8 @@ function Invoke-WPFButton {
|
||||
"WPFInstall" {Invoke-WPFInstall}
|
||||
"WPFUninstall" {Invoke-WPFUnInstall}
|
||||
"WPFInstallUpgrade" {Invoke-WPFInstallUpgrade}
|
||||
"WPFCollapseAllCategories" {Invoke-WPFToggleAllCategories -Action "Collapse"}
|
||||
"WPFExpandAllCategories" {Invoke-WPFToggleAllCategories -Action "Expand"}
|
||||
"WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"}
|
||||
"WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"}
|
||||
"WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"}
|
||||
|
||||
51
functions/public/Invoke-WPFToggleAllCategories.ps1
Normal file
51
functions/public/Invoke-WPFToggleAllCategories.ps1
Normal file
@@ -0,0 +1,51 @@
|
||||
function Invoke-WPFToggleAllCategories {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Expands or collapses all categories in the Install tab
|
||||
|
||||
.PARAMETER Action
|
||||
The action to perform: "Expand" or "Collapse"
|
||||
|
||||
.DESCRIPTION
|
||||
This function iterates through all category containers in the Install tab
|
||||
and expands or collapses their WrapPanels while updating the toggle button labels
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[ValidateSet("Expand", "Collapse")]
|
||||
[string]$Action
|
||||
)
|
||||
|
||||
try {
|
||||
if ($null -eq $sync.ItemsControl) {
|
||||
Write-Warning "ItemsControl not initialized"
|
||||
return
|
||||
}
|
||||
|
||||
$targetVisibility = if ($Action -eq "Expand") { [Windows.Visibility]::Visible } else { [Windows.Visibility]::Collapsed }
|
||||
$targetPrefix = if ($Action -eq "Expand") { "-" } else { "+" }
|
||||
$sourcePrefix = if ($Action -eq "Expand") { "+" } else { "-" }
|
||||
|
||||
# Iterate through all items in the ItemsControl
|
||||
$sync.ItemsControl.Items | ForEach-Object {
|
||||
$categoryContainer = $_
|
||||
|
||||
# Check if this is a category container (StackPanel with children)
|
||||
if ($categoryContainer -is [System.Windows.Controls.StackPanel] -and $categoryContainer.Children.Count -ge 2) {
|
||||
# Get the WrapPanel (second child)
|
||||
$wrapPanel = $categoryContainer.Children[1]
|
||||
$wrapPanel.Visibility = $targetVisibility
|
||||
|
||||
# Update the label to show the correct state
|
||||
$categoryLabel = $categoryContainer.Children[0]
|
||||
if ($categoryLabel.Content -like "$sourcePrefix*") {
|
||||
$categoryLabel.Content = $categoryLabel.Content -replace "^$sourcePrefix ", "$targetPrefix "
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Error toggling categories: $_"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user