mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-24 06:51:30 -06:00
initial visual implementation
- remove idiotic border logic from Invoke-WPFUIElements - add "application" type & style - add "radiobutton" type & style - remove prefer choco checkbox (did not modify logic outside of xaml, so i currently get errors due to that)
This commit is contained in:
parent
225e774f1e
commit
a1188871f4
@ -171,6 +171,7 @@
|
|||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
"choco": "brave",
|
"choco": "brave",
|
||||||
"content": "Brave",
|
"content": "Brave",
|
||||||
|
"Type": "application",
|
||||||
"description": "Brave is a privacy-focused web browser that blocks ads and trackers, offering a faster and safer browsing experience.",
|
"description": "Brave is a privacy-focused web browser that blocks ads and trackers, offering a faster and safer browsing experience.",
|
||||||
"link": "https://www.brave.com",
|
"link": "https://www.brave.com",
|
||||||
"winget": "Brave.Brave"
|
"winget": "Brave.Brave"
|
||||||
@ -233,6 +234,7 @@
|
|||||||
},
|
},
|
||||||
"chrome": {
|
"chrome": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "googlechrome",
|
"choco": "googlechrome",
|
||||||
"content": "Chrome",
|
"content": "Chrome",
|
||||||
"description": "Google Chrome is a widely used web browser known for its speed, simplicity, and seamless integration with Google services.",
|
"description": "Google Chrome is a widely used web browser known for its speed, simplicity, and seamless integration with Google services.",
|
||||||
@ -241,6 +243,7 @@
|
|||||||
},
|
},
|
||||||
"chromium": {
|
"chromium": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "chromium",
|
"choco": "chromium",
|
||||||
"content": "Chromium",
|
"content": "Chromium",
|
||||||
"description": "Chromium is the open-source project that serves as the foundation for various web browsers, including Chrome.",
|
"description": "Chromium is the open-source project that serves as the foundation for various web browsers, including Chrome.",
|
||||||
@ -249,6 +252,7 @@
|
|||||||
},
|
},
|
||||||
"arc": {
|
"arc": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
"content": "Arc",
|
"content": "Arc",
|
||||||
"description": "Arc is a Chromium based browser, known for it's clean and modern design.",
|
"description": "Arc is a Chromium based browser, known for it's clean and modern design.",
|
||||||
@ -473,6 +477,7 @@
|
|||||||
},
|
},
|
||||||
"edge": {
|
"edge": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "microsoft-edge",
|
"choco": "microsoft-edge",
|
||||||
"content": "Edge",
|
"content": "Edge",
|
||||||
"description": "Microsoft Edge is a modern web browser built on Chromium, offering performance, security, and integration with Microsoft services.",
|
"description": "Microsoft Edge is a modern web browser built on Chromium, offering performance, security, and integration with Microsoft services.",
|
||||||
@ -529,6 +534,7 @@
|
|||||||
},
|
},
|
||||||
"falkon": {
|
"falkon": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "falkon",
|
"choco": "falkon",
|
||||||
"content": "Falkon",
|
"content": "Falkon",
|
||||||
"description": "Falkon is a lightweight and fast web browser with a focus on user privacy and efficiency.",
|
"description": "Falkon is a lightweight and fast web browser with a focus on user privacy and efficiency.",
|
||||||
@ -585,6 +591,7 @@
|
|||||||
},
|
},
|
||||||
"firefox": {
|
"firefox": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "firefox",
|
"choco": "firefox",
|
||||||
"content": "Firefox",
|
"content": "Firefox",
|
||||||
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions.",
|
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions.",
|
||||||
@ -593,6 +600,7 @@
|
|||||||
},
|
},
|
||||||
"firefoxesr": {
|
"firefoxesr": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "FirefoxESR",
|
"choco": "FirefoxESR",
|
||||||
"content": "Firefox ESR",
|
"content": "Firefox ESR",
|
||||||
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.",
|
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.",
|
||||||
@ -617,6 +625,7 @@
|
|||||||
},
|
},
|
||||||
"floorp": {
|
"floorp": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
"content": "Floorp",
|
"content": "Floorp",
|
||||||
"description": "Floorp is an open-source web browser project that aims to provide a simple and fast browsing experience.",
|
"description": "Floorp is an open-source web browser project that aims to provide a simple and fast browsing experience.",
|
||||||
@ -1089,6 +1098,7 @@
|
|||||||
},
|
},
|
||||||
"librewolf": {
|
"librewolf": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "librewolf",
|
"choco": "librewolf",
|
||||||
"content": "LibreWolf",
|
"content": "LibreWolf",
|
||||||
"description": "LibreWolf is a privacy-focused web browser based on Firefox, with additional privacy and security enhancements.",
|
"description": "LibreWolf is a privacy-focused web browser based on Firefox, with additional privacy and security enhancements.",
|
||||||
@ -1281,6 +1291,7 @@
|
|||||||
},
|
},
|
||||||
"mullvadbrowser": {
|
"mullvadbrowser": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
"content": "Mullvad Browser",
|
"content": "Mullvad Browser",
|
||||||
"description": "Mullvad Browser is a privacy-focused web browser, developed in partnership with the Tor Project.",
|
"description": "Mullvad Browser is a privacy-focused web browser, developed in partnership with the Tor Project.",
|
||||||
@ -2193,6 +2204,7 @@
|
|||||||
},
|
},
|
||||||
"thorium": {
|
"thorium": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "na",
|
"choco": "na",
|
||||||
"content": "Thorium Browser AVX2",
|
"content": "Thorium Browser AVX2",
|
||||||
"description": "Browser built for speed over vanilla chromium. It is built with AVX2 optimizations and is the fastest browser on the market.",
|
"description": "Browser built for speed over vanilla chromium. It is built with AVX2 optimizations and is the fastest browser on the market.",
|
||||||
@ -2225,6 +2237,7 @@
|
|||||||
},
|
},
|
||||||
"tor": {
|
"tor": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "tor-browser",
|
"choco": "tor-browser",
|
||||||
"content": "Tor Browser",
|
"content": "Tor Browser",
|
||||||
"description": "Tor Browser is designed for anonymous web browsing, utilizing the Tor network to protect user privacy and security.",
|
"description": "Tor Browser is designed for anonymous web browsing, utilizing the Tor network to protect user privacy and security.",
|
||||||
@ -2273,6 +2286,7 @@
|
|||||||
},
|
},
|
||||||
"ungoogled": {
|
"ungoogled": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "ungoogled-chromium",
|
"choco": "ungoogled-chromium",
|
||||||
"content": "Ungoogled",
|
"content": "Ungoogled",
|
||||||
"description": "Ungoogled Chromium is a version of Chromium without Google's integration for enhanced privacy and control.",
|
"description": "Ungoogled Chromium is a version of Chromium without Google's integration for enhanced privacy and control.",
|
||||||
@ -2353,6 +2367,7 @@
|
|||||||
},
|
},
|
||||||
"vivaldi": {
|
"vivaldi": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "vivaldi",
|
"choco": "vivaldi",
|
||||||
"content": "Vivaldi",
|
"content": "Vivaldi",
|
||||||
"description": "Vivaldi is a highly customizable web browser with a focus on user personalization and productivity features.",
|
"description": "Vivaldi is a highly customizable web browser with a focus on user personalization and productivity features.",
|
||||||
@ -2409,6 +2424,7 @@
|
|||||||
},
|
},
|
||||||
"waterfox": {
|
"waterfox": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "waterfox",
|
"choco": "waterfox",
|
||||||
"content": "Waterfox",
|
"content": "Waterfox",
|
||||||
"description": "Waterfox is a fast, privacy-focused web browser based on Firefox, designed to preserve user choice and privacy.",
|
"description": "Waterfox is a fast, privacy-focused web browser based on Firefox, designed to preserve user choice and privacy.",
|
||||||
@ -2881,6 +2897,7 @@
|
|||||||
},
|
},
|
||||||
"PaleMoon": {
|
"PaleMoon": {
|
||||||
"category": "Browsers",
|
"category": "Browsers",
|
||||||
|
"Type": "application",
|
||||||
"choco": "paleMoon",
|
"choco": "paleMoon",
|
||||||
"content": "PaleMoon",
|
"content": "PaleMoon",
|
||||||
"description":"Pale Moon is an Open Source, Goanna-based web browser available for Microsoft Windows and Linux (with other operating systems in development), focusing on efficiency and ease of use.",
|
"description":"Pale Moon is an Open Source, Goanna-based web browser available for Microsoft Windows and Linux (with other operating systems in development), focusing on efficiency and ease of use.",
|
||||||
|
@ -120,25 +120,6 @@ function Invoke-WPFUIElements {
|
|||||||
|
|
||||||
foreach ($category in ($organizedData[$panelKey].Keys | Sort-Object)) {
|
foreach ($category in ($organizedData[$panelKey].Keys | Sort-Object)) {
|
||||||
$count++
|
$count++
|
||||||
if ($targetGridName -eq "appspanel" -and $columncount -gt 0) {
|
|
||||||
$panelcount2 = [Int](($count) / $maxcount - 0.5)
|
|
||||||
if ($panelcount -eq $panelcount2) {
|
|
||||||
# Create a new Border for the new column
|
|
||||||
$border = New-Object Windows.Controls.Border
|
|
||||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
|
||||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
|
||||||
$border.style = $borderstyle
|
|
||||||
$targetGrid.Children.Add($border) | Out-Null
|
|
||||||
|
|
||||||
# Create a new StackPanel inside the Border
|
|
||||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
|
||||||
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
|
|
||||||
$stackPanel.SnapsToDevicePixels = $true
|
|
||||||
$stackPanel.VerticalAlignment = "Stretch" # Ensure the stack panel stretches vertically
|
|
||||||
$border.Child = $stackPanel
|
|
||||||
$panelcount++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$label = New-Object Windows.Controls.Label
|
$label = New-Object Windows.Controls.Label
|
||||||
$label.Content = $category -replace ".*__", ""
|
$label.Content = $category -replace ".*__", ""
|
||||||
@ -152,25 +133,6 @@ function Invoke-WPFUIElements {
|
|||||||
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name
|
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name
|
||||||
foreach ($entryInfo in $entries) {
|
foreach ($entryInfo in $entries) {
|
||||||
$count++
|
$count++
|
||||||
if ($targetGridName -eq "appspanel" -and $columncount -gt 0) {
|
|
||||||
$panelcount2 = [Int](($count) / $maxcount - 0.5)
|
|
||||||
if ($panelcount -eq $panelcount2) {
|
|
||||||
# Create a new Border for the new column
|
|
||||||
$border = New-Object Windows.Controls.Border
|
|
||||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
|
||||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
|
||||||
$border.style = $borderstyle
|
|
||||||
$targetGrid.Children.Add($border) | Out-Null
|
|
||||||
|
|
||||||
# Create a new StackPanel inside the Border
|
|
||||||
$stackPanel = New-Object Windows.Controls.StackPanel
|
|
||||||
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
|
|
||||||
$stackPanel.SnapsToDevicePixels = $true
|
|
||||||
$stackPanel.VerticalAlignment = "Stretch" # Ensure the stack panel stretches vertically
|
|
||||||
$border.Child = $stackPanel
|
|
||||||
$panelcount++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($entryInfo.Type) {
|
switch ($entryInfo.Type) {
|
||||||
"Toggle" {
|
"Toggle" {
|
||||||
@ -282,6 +244,149 @@ function Invoke-WPFUIElements {
|
|||||||
$sync[$entryInfo.Name] = $button
|
$sync[$entryInfo.Name] = $button
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"RadioButton" {
|
||||||
|
$radioButton = New-Object Windows.Controls.RadioButton
|
||||||
|
$radioButton.Name = $entryInfo.Name
|
||||||
|
$radioButton.GroupName = $entryInfo.GroupName
|
||||||
|
$radioButton.Content = $entryInfo.Content
|
||||||
|
$radioButton.HorizontalAlignment = "Left"
|
||||||
|
$radioButton.Margin = $theme.CheckBoxMargin
|
||||||
|
$radioButton.FontSize = $theme.ButtonFontSize
|
||||||
|
$radioButton.ToolTip = $entryInfo.Description
|
||||||
|
|
||||||
|
if ($entryInfo.Checked -eq $true) {
|
||||||
|
$radioButton.IsChecked = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
$stackPanel.Children.Add($radioButton) | Out-Null
|
||||||
|
$sync[$entryInfo.Name] = $radioButton
|
||||||
|
}
|
||||||
|
|
||||||
|
"application" {
|
||||||
|
# Create the outer Border for the application type
|
||||||
|
$border = New-Object Windows.Controls.Border
|
||||||
|
$border.BorderBrush = [Windows.Media.Brushes]::Gray
|
||||||
|
$border.BorderThickness = 1
|
||||||
|
$border.CornerRadius = 5
|
||||||
|
$border.Padding = New-Object Windows.Thickness(10)
|
||||||
|
$border.HorizontalAlignment = "Stretch"
|
||||||
|
$border.VerticalAlignment = "Top"
|
||||||
|
$border.Margin = New-Object Windows.Thickness(0, 10, 0, 0)
|
||||||
|
|
||||||
|
# Create a DockPanel inside the Border
|
||||||
|
$dockPanel = New-Object Windows.Controls.DockPanel
|
||||||
|
$dockPanel.LastChildFill = $true
|
||||||
|
$border.Child = $dockPanel
|
||||||
|
|
||||||
|
# Create the CheckBox, vertically centered
|
||||||
|
$checkBox = New-Object Windows.Controls.CheckBox
|
||||||
|
$checkBox.Name = $entryInfo.Name
|
||||||
|
$checkBox.HorizontalAlignment = "Left"
|
||||||
|
$checkBox.VerticalAlignment = "Center"
|
||||||
|
$checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0)
|
||||||
|
[Windows.Controls.DockPanel]::SetDock($checkBox, [Windows.Controls.Dock]::Left)
|
||||||
|
$dockPanel.Children.Add($checkBox) | Out-Null
|
||||||
|
|
||||||
|
# Create a StackPanel for the image and name (for better alignment)
|
||||||
|
$imageAndNamePanel = New-Object Windows.Controls.StackPanel
|
||||||
|
$imageAndNamePanel.Orientation = "Horizontal"
|
||||||
|
$imageAndNamePanel.VerticalAlignment = "Center"
|
||||||
|
|
||||||
|
# Create the Image and load it from the local path
|
||||||
|
$image = New-Object Windows.Controls.Image
|
||||||
|
$image.Width = 40
|
||||||
|
$image.Height = 40
|
||||||
|
$image.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
|
||||||
|
$image.Source = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new("file:///$env:LOCALAPPDATA/winutil/cttlogo.ico"))
|
||||||
|
$imageAndNamePanel.Children.Add($image) | Out-Null
|
||||||
|
|
||||||
|
# Create the TextBlock for the application name (bigger and bold)
|
||||||
|
$appName = New-Object Windows.Controls.TextBlock
|
||||||
|
$appName.Text = $entryInfo.Content
|
||||||
|
$appName.FontSize = 16
|
||||||
|
$appName.FontWeight = [Windows.FontWeights]::Bold
|
||||||
|
$appName.VerticalAlignment = "Center"
|
||||||
|
$appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0)
|
||||||
|
$imageAndNamePanel.Children.Add($appName) | Out-Null
|
||||||
|
|
||||||
|
# Add the image and name panel to the dock panel (after the checkbox)
|
||||||
|
[Windows.Controls.DockPanel]::SetDock($imageAndNamePanel, [Windows.Controls.Dock]::Left)
|
||||||
|
$dockPanel.Children.Add($imageAndNamePanel) | Out-Null
|
||||||
|
|
||||||
|
# Create the StackPanel for the buttons and dock it to the right
|
||||||
|
$buttonPanel = New-Object Windows.Controls.StackPanel
|
||||||
|
$buttonPanel.Orientation = "Horizontal"
|
||||||
|
$buttonPanel.HorizontalAlignment = "Right"
|
||||||
|
$buttonPanel.VerticalAlignment = "Center"
|
||||||
|
$buttonPanel.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
|
||||||
|
[Windows.Controls.DockPanel]::SetDock($buttonPanel, [Windows.Controls.Dock]::Right)
|
||||||
|
|
||||||
|
# Create the "Install" button with the install icon from Segoe MDL2 Assets
|
||||||
|
$button1 = New-Object Windows.Controls.Button
|
||||||
|
$button1.Width = 45
|
||||||
|
$button1.Height = 35
|
||||||
|
$button1.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
|
||||||
|
|
||||||
|
$installIcon = New-Object Windows.Controls.TextBlock
|
||||||
|
$installIcon.Text = [char]0xE118 # Install Icon
|
||||||
|
$installIcon.FontFamily = "Segoe MDL2 Assets"
|
||||||
|
$installIcon.FontSize = 20
|
||||||
|
$installIcon.Foreground = $theme.MainForegroundColor
|
||||||
|
$installIcon.Background = "Transparent"
|
||||||
|
$installIcon.HorizontalAlignment = "Center"
|
||||||
|
$installIcon.VerticalAlignment = "Center"
|
||||||
|
|
||||||
|
$button1.Content = $installIcon
|
||||||
|
$buttonPanel.Children.Add($button1) | Out-Null
|
||||||
|
|
||||||
|
# Create the "Uninstall" button with the uninstall icon from Segoe MDL2 Assets
|
||||||
|
$button2 = New-Object Windows.Controls.Button
|
||||||
|
$button2.Width = 45
|
||||||
|
$button2.Height = 35
|
||||||
|
|
||||||
|
$uninstallIcon = New-Object Windows.Controls.TextBlock
|
||||||
|
$uninstallIcon.Text = [char]0xE10A # Uninstall Icon
|
||||||
|
$uninstallIcon.FontFamily = "Segoe MDL2 Assets"
|
||||||
|
$uninstallIcon.FontSize = 20
|
||||||
|
$uninstallIcon.Foreground = $theme.MainForegroundColor
|
||||||
|
$uninstallIcon.Background = "Transparent"
|
||||||
|
$uninstallIcon.HorizontalAlignment = "Center"
|
||||||
|
$uninstallIcon.VerticalAlignment = "Center"
|
||||||
|
|
||||||
|
$button2.Content = $uninstallIcon
|
||||||
|
$buttonPanel.Children.Add($button2) | Out-Null
|
||||||
|
|
||||||
|
# Create the "Info" button with the info icon from Segoe MDL2 Assets
|
||||||
|
$infoButton = New-Object Windows.Controls.Button
|
||||||
|
$infoButton.Width = 45
|
||||||
|
$infoButton.Height = 35
|
||||||
|
$infoButton.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
|
||||||
|
|
||||||
|
$infoIcon = New-Object Windows.Controls.TextBlock
|
||||||
|
$infoIcon.Text = [char]0xE946 # Info Icon
|
||||||
|
$infoIcon.FontFamily = "Segoe MDL2 Assets"
|
||||||
|
$infoIcon.FontSize = 20
|
||||||
|
$infoIcon.Foreground = $theme.MainForegroundColor
|
||||||
|
$infoIcon.Background = "Transparent"
|
||||||
|
$infoIcon.HorizontalAlignment = "Center"
|
||||||
|
$infoIcon.VerticalAlignment = "Center"
|
||||||
|
|
||||||
|
$infoButton.Content = $infoIcon
|
||||||
|
$buttonPanel.Children.Add($infoButton) | Out-Null
|
||||||
|
|
||||||
|
# Add the button panel to the DockPanel
|
||||||
|
$dockPanel.Children.Add($buttonPanel) | Out-Null
|
||||||
|
|
||||||
|
# Add the border to the main stack panel in the grid
|
||||||
|
$stackPanel.Children.Add($border) | Out-Null
|
||||||
|
|
||||||
|
# Sync the CheckBox, buttons, and info to the sync object for further use
|
||||||
|
$sync[$entryInfo.Name] = $checkBox
|
||||||
|
$sync[$entryInfo.Name + "_InstallButton"] = $button1
|
||||||
|
$sync[$entryInfo.Name + "_UninstallButton"] = $button2
|
||||||
|
$sync[$entryInfo.Name + "_InfoButton"] = $infoButton
|
||||||
|
}
|
||||||
|
|
||||||
default {
|
default {
|
||||||
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
||||||
$horizontalStackPanel.Orientation = "Horizontal"
|
$horizontalStackPanel.Orientation = "Horizontal"
|
||||||
|
105
scripts/main.ps1
105
scripts/main.ps1
@ -111,8 +111,109 @@ $sync.Form.Add_Loaded({
|
|||||||
|
|
||||||
Invoke-WinutilThemeChange -init $true
|
Invoke-WinutilThemeChange -init $true
|
||||||
# Load the configuration files
|
# Load the configuration files
|
||||||
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
|
|
||||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
|
|
||||||
|
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 1
|
||||||
|
|
||||||
|
# Extract unique categories from the applications configuration
|
||||||
|
$uniqueCategories = $sync.configs.applications.PSObject.Properties.Value |
|
||||||
|
Where-Object { $_.Category } |
|
||||||
|
Select-Object -Unique -ExpandProperty Category
|
||||||
|
|
||||||
|
# Create a custom PSCustomObject to simulate category-level checkboxes
|
||||||
|
$categoryConfig = @{}
|
||||||
|
|
||||||
|
foreach ($category in $uniqueCategories) {
|
||||||
|
# Sanitize the category name for use in the Name property (remove spaces, special characters)
|
||||||
|
$sanitizedCategoryName = $category -replace '\W', '_'
|
||||||
|
|
||||||
|
$categoryConfig[$sanitizedCategoryName] = [PSCustomObject]@{
|
||||||
|
Category = "Categories"
|
||||||
|
Content = $category # Keep original category name for display
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Adding dynamically two radiobuttons for "Package Manager" category with GroupName
|
||||||
|
$packageManagerConfig = @{
|
||||||
|
"WPFWingetRadioButton" = [PSCustomObject]@{
|
||||||
|
Name = "WingetRadioButton"
|
||||||
|
Content = "Winget"
|
||||||
|
Category = "__Package Manager"
|
||||||
|
Type = "RadioButton"
|
||||||
|
GroupName = "PackageManagerGroup"
|
||||||
|
Checked = $true
|
||||||
|
Order = "1"
|
||||||
|
Description = "Use Winget for package management"
|
||||||
|
}
|
||||||
|
"WPFChocoRadioButton" = [PSCustomObject]@{
|
||||||
|
Name = "ChocoRadioButton"
|
||||||
|
Content = "Chocolatey"
|
||||||
|
Category = "__Package Manager"
|
||||||
|
Type = "RadioButton"
|
||||||
|
GroupName = "PackageManagerGroup"
|
||||||
|
Checked = $false
|
||||||
|
Order = "2"
|
||||||
|
Description = "Use Chocolatey for package management"
|
||||||
|
}
|
||||||
|
"WPFautofallback" = [PSCustomObject]@{
|
||||||
|
Name = "AutoRadioButton"
|
||||||
|
Content = "Auto Fallback"
|
||||||
|
Category = "__Package Manager"
|
||||||
|
Checked = $true
|
||||||
|
Order = "3"
|
||||||
|
Description = "If the selected package manager fails, automatically switch to the other one"
|
||||||
|
}
|
||||||
|
"WPFDefaultScope" = [PSCustomObject]@{
|
||||||
|
Name = "DefaultScope"
|
||||||
|
Content = "Default"
|
||||||
|
Category = "_Installation Scope"
|
||||||
|
Type = "RadioButton"
|
||||||
|
GroupName = "InstallationScopeGroup"
|
||||||
|
Checked = $true
|
||||||
|
Order = "1"
|
||||||
|
Description = "Use the default scope of the application"
|
||||||
|
}
|
||||||
|
"WPFUserScope" = [PSCustomObject]@{
|
||||||
|
Name = "UserScope"
|
||||||
|
Content = "User"
|
||||||
|
Category = "_Installation Scope"
|
||||||
|
Type = "RadioButton"
|
||||||
|
GroupName = "InstallationScopeGroup"
|
||||||
|
Checked = $false
|
||||||
|
Order = "2"
|
||||||
|
Description = "If possible, install the application only for the current user"
|
||||||
|
}
|
||||||
|
"WPFGlobalMachineScope" = [PSCustomObject]@{
|
||||||
|
Name = "GlobalMachineScope"
|
||||||
|
Content = "Global (Machine)"
|
||||||
|
Category = "_Installation Scope"
|
||||||
|
Type = "RadioButton"
|
||||||
|
GroupName = "InstallationScopeGroup"
|
||||||
|
Checked = $false
|
||||||
|
Order = "3"
|
||||||
|
Description = "If possible, install the application globally for all users"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Merge the packageManagerConfig with the existing category config
|
||||||
|
$finalConfig = @{}
|
||||||
|
$categoryConfig.Keys | ForEach-Object {
|
||||||
|
$finalConfig[$_] = $categoryConfig[$_]
|
||||||
|
}
|
||||||
|
$packageManagerConfig.Keys | ForEach-Object {
|
||||||
|
$finalConfig[$_] = $packageManagerConfig[$_]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert to PSCustomObject for function input
|
||||||
|
$finalConfigObject = [PSCustomObject]@{}
|
||||||
|
$finalConfig.Keys | ForEach-Object {
|
||||||
|
Add-Member -InputObject $finalConfigObject -MemberType NoteProperty -Name $_ -Value $finalConfig[$_]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now call the function with the final merged config
|
||||||
|
Invoke-WPFUIElements -configVariable $finalConfigObject -targetGridName "appscategory" -columncount 1
|
||||||
|
|
||||||
|
|
||||||
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
|
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
|
||||||
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
|
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
|
||||||
|
|
||||||
|
@ -927,14 +927,18 @@
|
|||||||
<Button Name="WPFUninstall" Content=" Uninstall Selected" Margin="2"/>
|
<Button Name="WPFUninstall" Content=" Uninstall Selected" Margin="2"/>
|
||||||
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>
|
<Button Name="WPFGetInstalled" Content=" Get Installed" Margin="2"/>
|
||||||
<Button Name="WPFClearInstallSelection" Content=" Clear Selection" Margin="2"/>
|
<Button Name="WPFClearInstallSelection" Content=" Clear Selection" Margin="2"/>
|
||||||
<CheckBox Name="WPFpreferChocolatey" VerticalAlignment="Center" VerticalContentAlignment="Center">
|
|
||||||
<TextBlock Text="Prefer Chocolatey" ToolTip="Prefers Chocolatey as Download Engine instead of Winget" VerticalAlignment="Center" />
|
|
||||||
</CheckBox>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Margin="{DynamicResource TabContentMargin}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
|
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Margin="{DynamicResource TabContentMargin}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Grid>
|
||||||
<Grid Name="appspanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Name="appscategory" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
</Grid>
|
||||||
|
<Grid Name="appspanel" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user