winutil/functions/public/Invoke-WPFUIElements.ps1

336 lines
15 KiB
PowerShell
Raw Normal View History

[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
function Invoke-WPFUIElements {
<#
.SYNOPSIS
Adds UI elements to a specified Grid in the WinUtil GUI based on a JSON configuration.
.PARAMETER configVariable
The variable/link containing the JSON configuration.
.PARAMETER targetGridName
The name of the grid to which the UI elements should be added.
.PARAMETER columncount
The number of columns to be used in the Grid. If not provided, a default value is used based on the panel.
.EXAMPLE
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "install" -columncount 5
.NOTES
Future me/contributer: If possible please wrap this into a runspace to make it load all panels at the same time.
#>
param(
[Parameter(Mandatory, position=0)]
[PSCustomObject]$configVariable,
[Parameter(Mandatory, position=1)]
[string]$targetGridName,
[Parameter(Mandatory, position=2)]
[int]$columncount
)
$window = $sync["Form"]
$theme = $sync.Form.Resources
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$borderstyle = $window.FindResource("BorderStyle")
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")
if (!$borderstyle -or !$HoverTextBlockStyle -or !$ColorfulToggleSwitchStyle) {
throw "Failed to retrieve Styles using 'FindResource' from main window element."
}
$targetGrid = $window.FindName($targetGridName)
if (!$targetGrid) {
throw "Failed to retrieve Target Grid by name, provided name: $targetGrid"
}
# Clear existing ColumnDefinitions and Children
$targetGrid.ColumnDefinitions.Clear() | Out-Null
$targetGrid.Children.Clear() | Out-Null
# Add ColumnDefinitions to the target Grid
for ($i = 0; $i -lt $columncount; $i++) {
$colDef = New-Object Windows.Controls.ColumnDefinition
$colDef.Width = New-Object Windows.GridLength(1, [Windows.GridUnitType]::Star)
$targetGrid.ColumnDefinitions.Add($colDef) | Out-Null
}
# Convert PSCustomObject to Hashtable
$configHashtable = @{}
$configVariable.PSObject.Properties.Name | ForEach-Object {
$configHashtable[$_] = $configVariable.$_
}
$organizedData = @{}
# Iterate through JSON data and organize by panel and category
foreach ($entry in $configHashtable.Keys) {
$entryInfo = $configHashtable[$entry]
# Create an object for the application
$entryObject = [PSCustomObject]@{
Name = $entry
Order = $entryInfo.order
Category = $entryInfo.Category
Content = $entryInfo.Content
Choco = $entryInfo.choco
Winget = $entryInfo.winget
Panel = if ($entryInfo.Panel) { $entryInfo.Panel } else { "0" }
Link = $entryInfo.link
Description = $entryInfo.description
Type = $entryInfo.type
ComboItems = $entryInfo.ComboItems
Checked = $entryInfo.Checked
ButtonWidth = $entryInfo.ButtonWidth
}
if (-not $organizedData.ContainsKey($entryObject.Panel)) {
$organizedData[$entryObject.Panel] = @{}
}
if (-not $organizedData[$entryObject.Panel].ContainsKey($entryObject.Category)) {
$organizedData[$entryObject.Panel][$entryObject.Category] = @()
}
# Store application data in an array under the category
$organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
if ($targetGridName -eq "appspanel") {
$panelcount = 0
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
$maxcount = [Math]::Round($entrycount / $columncount + 0.5)
}
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
}
# Iterate through 'organizedData' by panel, category, and application
$count = 0
foreach ($panelKey in ($organizedData.Keys | Sort-Object)) {
# Create a Border for each column
$border = New-Object Windows.Controls.Border
$border.VerticalAlignment = "Stretch"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
$border.style = $borderstyle
$targetGrid.Children.Add($border) | Out-Null
# Create a StackPanel inside the Border
$stackPanel = New-Object Windows.Controls.StackPanel
$stackPanel.Background = [Windows.Media.Brushes]::Transparent
$stackPanel.SnapsToDevicePixels = $true
$stackPanel.VerticalAlignment = "Stretch"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$border.Child = $stackPanel
$panelcount++
# Add Windows Version label if this is the updates panel
if ($targetGridName -eq "updatespanel") {
$windowsVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName
$versionLabel = New-Object Windows.Controls.Label
$versionLabel.Content = "Windows Version: $windowsVersion"
$versionLabel.FontSize = $theme.FontSize
$versionLabel.HorizontalAlignment = "Left"
$stackPanel.Children.Add($versionLabel) | Out-Null
}
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
foreach ($category in ($organizedData[$panelKey].Keys | Sort-Object)) {
$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"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
[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"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$border.Child = $stackPanel
$panelcount++
}
}
$label = New-Object Windows.Controls.Label
$label.Content = $category -replace ".*__", ""
[UI/UX] Update the look & feel of the GUI (#2884) * Add @CodingWonders to the About page for his contribution and determination to make WinUtil (and MicroWin) the best software it can be! * Remove the 'LogoSize' Parameter for About page - Make every sponsor in the sponsors list a link to ChrisTitusTech's Sponsors web link * Change Theme Option name from 'ConfigTabButtonFontSize' to 'ConfigUpdateButtonFontSize' - Lower its value from 16 to 14 * Change Theme Option name from 'FontSizeHeading' to 'HeadingFontSize' for consistency * Update 'LinkForegroundColor' for Light Theme to be lighter which'll make link hover color more noticeable * Update 'Show-CustomDialog' Private Function - Made a lot of theming/styling choices for Custom Dialogs exposed as parameters. - Update the documentation for these new parameters in 'Show-CustomDialog' Function. - Add a Link Hover Effect using 'Add_EVENT' methods (This can be tweaks/tuned-down if needed). - Made use of 'Title' Parameter for 'Show-CustomDialog' Function inside 'scripts/main.ps1' script, to change Dialog Window Title. - Now you can change the Logo Size of WinUtil through the 'LogoSize' Theming Option (the option was there, but not used in implementation). * Preprocessing result * Fix Settings Popup not closing after losing focus - Add trivial null checks for better debugging of UI code * Remove unnecessary whitespace indentation in 'main.ps1' script * Add a new 'Invoke-WPFPopup' Function to Better Handle Showing/Hiding/Toggling of Popups * Improve 'Invoke-WPFPopup' by @MyDrift-user Thanks for the improvements :) --------- Co-authored-by: MyDrift <personal@mdiana.ch> Co-authored-by: Chris Titus <contact@christitus.com>
2024-12-05 21:22:33 -06:00
$label.FontSize = $theme.HeadingFontSize
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$label.FontFamily = $theme.HeaderFontFamily
$stackPanel.Children.Add($label) | Out-Null
$sync[$category] = $label
# Sort entries by Order and then by Name, but only display Name
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name
foreach ($entryInfo in $entries) {
$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"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
[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"
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$border.Child = $stackPanel
$panelcount++
}
}
switch ($entryInfo.Type) {
"Toggle" {
$dockPanel = New-Object Windows.Controls.DockPanel
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name
$checkBox.HorizontalAlignment = "Right"
$dockPanel.Children.Add($checkBox) | Out-Null
$checkBox.Style = $ColorfulToggleSwitchStyle
$label = New-Object Windows.Controls.Label
$label.Content = $entryInfo.Content
$label.ToolTip = $entryInfo.Description
$label.HorizontalAlignment = "Left"
$label.FontSize = $theme.FontSize
$label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$dockPanel.Children.Add($label) | Out-Null
$stackPanel.Children.Add($dockPanel) | Out-Null
$sync[$entryInfo.Name] = $checkBox
[FEAT] TweakToggles logik overhaul (#3014) * move logic to json template - remove Invoke-WPFToggle.ps1 - generalize Get-WinUtilToggleStatus - add bingsearch reg key for testing - use Invoke-WinUtilTweaks for actions - replace Add-Click with checked & unchecked to make undo work * add reg params for toggles into tweaks.json - add all reg keys to tweaks.json into existing toggle entry - remove unneeded scripts * fix HKU - load HKU if needed (for tweaks & GetToggleStatus) - remove unneeded Invoke-WinUtilNumLock - has loaded HKU does not load/not stay loaded * add a lot of error handling * Bugfix: New-PSDrive seems to return the "hku" itself so weirdly gets prepended to the return value so the result becomes ("hku", $false). In powershell pretty much every variable that exists is interpreted as $true so the toggle for numlock got incorrectly checked * globally fix HKU error & minimize console feedback - fix HKU issue globally - remove some console logs, change some others to write-debug * update Explorerrefresh - change Invoke-WinUtilExplorerRefresh to handle refresh and restart - add restart logic to window snapping Flyout & Suggestions - rename Invoke-WinUtilExplorerRefresh to Invoke-WinUtilExplorerUpdate * add explorer restart where needed to take effect add explorer restart logic for hidden files + Fileextension toggles * fix missing theme change logic in darkmode toggle * fix window snapping - fix issue defining WindowArrangementActive as dword instead of string * fix bing search - switch bing search enabled/disabled values * add a little bit of error handling - add error handling for Get-WinUtilToggleStatus --------- Co-authored-by: Marterich <47688561+Marterich@users.noreply.github.com>
2024-12-05 21:24:36 -06:00
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
[FEAT] TweakToggles logik overhaul (#3014) * move logic to json template - remove Invoke-WPFToggle.ps1 - generalize Get-WinUtilToggleStatus - add bingsearch reg key for testing - use Invoke-WinUtilTweaks for actions - replace Add-Click with checked & unchecked to make undo work * add reg params for toggles into tweaks.json - add all reg keys to tweaks.json into existing toggle entry - remove unneeded scripts * fix HKU - load HKU if needed (for tweaks & GetToggleStatus) - remove unneeded Invoke-WinUtilNumLock - has loaded HKU does not load/not stay loaded * add a lot of error handling * Bugfix: New-PSDrive seems to return the "hku" itself so weirdly gets prepended to the return value so the result becomes ("hku", $false). In powershell pretty much every variable that exists is interpreted as $true so the toggle for numlock got incorrectly checked * globally fix HKU error & minimize console feedback - fix HKU issue globally - remove some console logs, change some others to write-debug * update Explorerrefresh - change Invoke-WinUtilExplorerRefresh to handle refresh and restart - add restart logic to window snapping Flyout & Suggestions - rename Invoke-WinUtilExplorerRefresh to Invoke-WinUtilExplorerUpdate * add explorer restart where needed to take effect add explorer restart logic for hidden files + Fileextension toggles * fix missing theme change logic in darkmode toggle * fix window snapping - fix issue defining WindowArrangementActive as dword instead of string * fix bing search - switch bing search enabled/disabled values * add a little bit of error handling - add error handling for Get-WinUtilToggleStatus --------- Co-authored-by: Marterich <47688561+Marterich@users.noreply.github.com>
2024-12-05 21:24:36 -06:00
$sync[$entryInfo.Name].Add_Checked({
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
[System.Object]$Sender = $args[0]
[FEAT] TweakToggles logik overhaul (#3014) * move logic to json template - remove Invoke-WPFToggle.ps1 - generalize Get-WinUtilToggleStatus - add bingsearch reg key for testing - use Invoke-WinUtilTweaks for actions - replace Add-Click with checked & unchecked to make undo work * add reg params for toggles into tweaks.json - add all reg keys to tweaks.json into existing toggle entry - remove unneeded scripts * fix HKU - load HKU if needed (for tweaks & GetToggleStatus) - remove unneeded Invoke-WinUtilNumLock - has loaded HKU does not load/not stay loaded * add a lot of error handling * Bugfix: New-PSDrive seems to return the "hku" itself so weirdly gets prepended to the return value so the result becomes ("hku", $false). In powershell pretty much every variable that exists is interpreted as $true so the toggle for numlock got incorrectly checked * globally fix HKU error & minimize console feedback - fix HKU issue globally - remove some console logs, change some others to write-debug * update Explorerrefresh - change Invoke-WinUtilExplorerRefresh to handle refresh and restart - add restart logic to window snapping Flyout & Suggestions - rename Invoke-WinUtilExplorerRefresh to Invoke-WinUtilExplorerUpdate * add explorer restart where needed to take effect add explorer restart logic for hidden files + Fileextension toggles * fix missing theme change logic in darkmode toggle * fix window snapping - fix issue defining WindowArrangementActive as dword instead of string * fix bing search - switch bing search enabled/disabled values * add a little bit of error handling - add error handling for Get-WinUtilToggleStatus --------- Co-authored-by: Marterich <47688561+Marterich@users.noreply.github.com>
2024-12-05 21:24:36 -06:00
Invoke-WinUtilTweaks $sender.name
})
$sync[$entryInfo.Name].Add_Unchecked({
[System.Object]$Sender = $args[0]
Invoke-WinUtiltweaks $sender.name -undo $true
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
})
}
"ToggleButton" {
$toggleButton = New-Object Windows.Controls.ToggleButton
$toggleButton.Name = $entryInfo.Name
$toggleButton.Name = "WPFTab" + ($stackPanel.Children.Count + 1) + "BT"
$toggleButton.HorizontalAlignment = "Left"
$toggleButton.Height = $theme.TabButtonHeight
$toggleButton.Width = $theme.TabButtonWidth
$toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor")
$toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$toggleButton.FontWeight = [Windows.FontWeights]::Bold
$textBlock = New-Object Windows.Controls.TextBlock
$textBlock.FontSize = $theme.TabButtonFontSize
$textBlock.Background = [Windows.Media.Brushes]::Transparent
$textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor")
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$underline = New-Object Windows.Documents.Underline
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
$run = New-Object Windows.Documents.Run
$run.Text = $entryInfo.name -replace "^.", ""
$textBlock.Inlines.Add($underline)
$textBlock.Inlines.Add($run)
$toggleButton.Content = $textBlock
$stackPanel.Children.Add($toggleButton) | Out-Null
$sync[$entryInfo.Name] = $toggleButton
}
"Combobox" {
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
$horizontalStackPanel.Orientation = "Horizontal"
$horizontalStackPanel.Margin = "0,5,0,0"
$label = New-Object Windows.Controls.Label
$label.Content = $entryInfo.Content
$label.HorizontalAlignment = "Left"
$label.VerticalAlignment = "Center"
$label.FontSize = $theme.ButtonFontSize
$horizontalStackPanel.Children.Add($label) | Out-Null
$comboBox = New-Object Windows.Controls.ComboBox
$comboBox.Name = $entryInfo.Name
$comboBox.Height = $theme.ButtonHeight
$comboBox.Width = $theme.ButtonWidth
$comboBox.HorizontalAlignment = "Left"
$comboBox.VerticalAlignment = "Center"
$comboBox.Margin = $theme.ButtonMargin
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem
$comboBoxItem.Content = $comboitem
$comboBoxItem.FontSize = $theme.ButtonFontSize
$comboBox.Items.Add($comboBoxItem) | Out-Null
}
$horizontalStackPanel.Children.Add($comboBox) | Out-Null
$stackPanel.Children.Add($horizontalStackPanel) | Out-Null
$comboBox.SelectedIndex = 0
$sync[$entryInfo.Name] = $comboBox
}
"Button" {
$button = New-Object Windows.Controls.Button
$button.Name = $entryInfo.Name
$button.Content = $entryInfo.Content
$button.HorizontalAlignment = "Left"
$button.Margin = $theme.ButtonMargin
$button.FontSize = $theme.ButtonFontSize
if ($entryInfo.ButtonWidth) {
$button.Width = $entryInfo.ButtonWidth
}
$stackPanel.Children.Add($button) | Out-Null
$sync[$entryInfo.Name] = $button
}
default {
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
$horizontalStackPanel.Orientation = "Horizontal"
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name
$checkBox.Content = $entryInfo.Content
$checkBox.FontSize = $theme.FontSize
$checkBox.ToolTip = $entryInfo.Description
$checkBox.Margin = $theme.CheckBoxMargin
if ($entryInfo.Checked -eq $true) {
[Refactoring UI Code] WIP: Inline UI Definition instead of xaml compilation (#2629) * try1: apps panel * refractor - removed Get-TabXaml.ps1 - removed compilation part from compile.ps1 - removed existing changes from main.ps1 - added Invoke-WinUtilUIElements.ps1 - refractor existing changes into new function - modified inputXML to call function * removed unused replacementlogics * fix toggle style * move naming from winutil to wpf * hotfixes - reworked function calling - working on correct theming support * hotfix * hotfix fix missing elements fix var naming * some fixes * hotfixes * add image logic * fix ? issue in search * filter out unneeded categories * cleanup * fix border styling * fixes * preprocessing * fix typo * last fixes & add notes * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * fix margin * fix tabcontent margin * fix some other margin issues * move fixed values outside of iterations * little fix * add Dispatcher.Invoke * add error handling for styles * Update functions/public/Invoke-WPFUIElements.ps1 Co-authored-by: Mr.k <mineshtine28546271@gmail.com> * remove dispatcher * fix search * move run & undo tweaks to be fixed * add error handling * fix throw exception * fixed accidental removal of findname grid call * add padding & margin to make search look good * remove grid to make it look correctly on small window * fix rectangle * Compiler Improvements for PR #2465 (#7) * Remove the Special Character Escaping for Json Files as there's no need for it anymore * Simplify 'application.json' Json Prefix Addition in 'Compile.ps1' Script Thanks to @fam007e for improving this section in his PR #2587 changes Co-authored-by: fam007e <faisalmoshiur@gmail.com> --------- Co-authored-by: fam007e <faisalmoshiur@gmail.com> * fix margin of search clear * fix cursor on clear search button * undo fixed run & undo * refractor themes.json * undo themes.json --------- Co-authored-by: Mr.k <mineshtine28546271@gmail.com> Co-authored-by: fam007e <faisalmoshiur@gmail.com> Co-authored-by: Chris Titus <contact@christitus.com>
2024-08-28 11:13:23 -05:00
$checkBox.IsChecked = $entryInfo.Checked
}
$horizontalStackPanel.Children.Add($checkBox) | Out-Null
if ($entryInfo.Link) {
$textBlock = New-Object Windows.Controls.TextBlock
$textBlock.Name = $checkBox.Name + "Link"
$textBlock.Text = "(?)"
$textBlock.ToolTip = $entryInfo.Link
$textBlock.Style = $HoverTextBlockStyle
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
$sync[$textBlock.Name] = $textBlock
}
$stackPanel.Children.Add($horizontalStackPanel) | Out-Null
$sync[$entryInfo.Name] = $checkBox
}
}
}
}
}
}