mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 09:04:47 -05:00
[01] Refactoring UI code (#2274)
* Update Documentation for 'Get-TabXaml' Function * Add More checks for Passed Parameters for 'Get-TabXaml' Function & A One Line change * Make 'Get-TabXaml' Function do Proper Indentation to the Generated XML String & Add more Theming Options * Re-formatting for a few lines in 'Get-TabXaml' Function * Improve UI a bit * Fix Buttons for Config Tab * Add optional 'ButtonWidth' Field to Config Json Files that use 'Button' Type * Simple Code Formatting in 'inputXML.xaml' File * Make naming More Clear to the Developers Rename the name of an element from 'CheckboxFilterClear' to 'SearchBarClearButton' and renamed style from 'ClearButtonStyle' to 'SearchBarClearButtonStyle' * Rename 'FontFamilyHeading' to 'HeaderFontFamily' to match conventions & Make new Theming Property called 'SearchBarClearButtonFontSize' * Remove Un-necessary 'ToString' Convertion in 'Get-TabXaml' Function * Make naming More Clear to the Developers again Rename the name of an element from 'CheckboxFilter' to 'SearchBar'.. although after some realization.. the naming might make sense at first, because it filters only the checkboxes.. but CheckBoxFilter is less "Intutive" when saying it compared to "SearchBar".. _This's my own opinion, and it can reverted easily with git if needed._ * Remove Un-necessary Attributes in 'Get-TabXaml' Private Function * Improve UI a bit * Improve UI a bit * Re-order some tweaks & Update their Content Fields to be more descriptive * Remove the changing 'Off' & 'On' TextBlock next to Toggle Button/Checkbox Removed it as it only takes up space in the right side of the Toggle Button/Checkbox, as well as making it difficult to correctly align it when change from/to 'On' & 'Off' Text, * Some changes to the Generated Toggle Button/Checkbox in 'Get-TabXaml' Private Function Increase the Side Margins of Toggle Button/Checkbox, as well as Change its side to be on the Left hand-side of the Label, rather then the Right hand-side.
This commit is contained in:
@ -15,6 +15,15 @@ function Show-CustomDialog {
|
||||
.PARAMETER Height
|
||||
The height of the custom dialog window.
|
||||
|
||||
.PARAMETER FontSize
|
||||
The Font Size for text shown inside the custom dialog window.
|
||||
|
||||
.PARAMETER HeaderFontSize
|
||||
The Font Size for the Header of the custom dialog window.
|
||||
|
||||
.PARAMETER IconSize
|
||||
The Size to use for Icon inside the custom dialog window.
|
||||
|
||||
.EXAMPLE
|
||||
Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200
|
||||
|
||||
@ -22,7 +31,10 @@ function Show-CustomDialog {
|
||||
param(
|
||||
[string]$Message,
|
||||
[int]$Width = 300,
|
||||
[int]$Height = 200
|
||||
[int]$Height = 200,
|
||||
[int]$FontSize = 10,
|
||||
[int]$HeaderFontSize = 14,
|
||||
[int]$IconSize = 25
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
@ -48,6 +60,7 @@ function Show-CustomDialog {
|
||||
$dialog.Foreground = $foregroundColor
|
||||
$dialog.Background = $backgroundColor
|
||||
$dialog.FontFamily = $font
|
||||
$dialog.FontSize = $FontSize
|
||||
|
||||
# Create a Border for the green edge with rounded corners
|
||||
$border = New-Object Windows.Controls.Border
|
||||
@ -111,8 +124,8 @@ function Show-CustomDialog {
|
||||
[Windows.Controls.Grid]::SetRow($stackPanel, 0) # Set the row to the second row (0-based index)
|
||||
|
||||
$viewbox = New-Object Windows.Controls.Viewbox
|
||||
$viewbox.Width = 25
|
||||
$viewbox.Height = 25
|
||||
$viewbox.Width = $IconSize
|
||||
$viewbox.Height = $IconSize
|
||||
|
||||
# Combine the paths into a single string
|
||||
# $cttLogoPath = @"
|
||||
@ -174,7 +187,7 @@ $cttLogoPath = @"
|
||||
# Add "Winutil" text
|
||||
$winutilTextBlock = New-Object Windows.Controls.TextBlock
|
||||
$winutilTextBlock.Text = "Winutil"
|
||||
$winutilTextBlock.FontSize = 18 # Adjust font size as needed
|
||||
$winutilTextBlock.FontSize = $HeaderFontSize
|
||||
$winutilTextBlock.Foreground = $foregroundColor
|
||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
||||
$stackPanel.Children.Add($winutilTextBlock)
|
||||
@ -242,6 +255,7 @@ $cttLogoPath = @"
|
||||
# Add OK button
|
||||
$okButton = New-Object Windows.Controls.Button
|
||||
$okButton.Content = "OK"
|
||||
$okButton.FontSize = $FontSize
|
||||
$okButton.Width = 80
|
||||
$okButton.Height = 30
|
||||
$okButton.HorizontalAlignment = [Windows.HorizontalAlignment]::Center
|
||||
|
Reference in New Issue
Block a user