Skip to content

Commit

Permalink
Improve UI a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
og-mrk committed Jun 30, 2024
1 parent 892f59a commit 3254314
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 53 deletions.
74 changes: 49 additions & 25 deletions config/themes.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"Classic": {
"IconFontSize": "18",
"IconButtonWidth": "35",
"IconButtonHeight": "35",
"CustomDialogFontSizeHeader": "30",
"CustomDialogIconSize": "40",
"CustomDialogFontSize": "16",
"CustomDialogWidth": "450",
"CustomDialogHeight": "250",
"FontSize": "16",
"FontSizeHeading": 24,
"FontFamily": "Comic Sans MS, Comic Sans",
"FontFamilyHeading": "Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New",
"FontSizeHeading": "24",
"FontFamily": "Arial",
"FontFamilyHeading": "Consolas, Monaco",
"TabFontSize": "14",
"IconFontSize": "18",
"IconButtonWidth": "36",
"IconButtonHeight": "36",
"MicroWinLogoSize": "12",
"ComboBoxBackgroundColor": "#FFFFFF",
"LabelboxForegroundColor": "#000000",
"MainForegroundColor": "#000000",
Expand Down Expand Up @@ -40,13 +47,20 @@
"ShadowPulse": "Forever"
},
"Matrix": {
"IconFontSize": "18",
"IconButtonWidth": "35",
"IconButtonHeight": "35",
"CustomDialogFontSizeHeader": "30",
"CustomDialogIconSize": "40",
"CustomDialogFontSize": "16",
"CustomDialogWidth": "450",
"CustomDialogHeight": "250",
"FontSize": "16",
"FontSizeHeading": 24,
"FontFamily": "Comic Sans MS, Comic Sans",
"FontFamilyHeading": "Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New",
"FontSizeHeading": "24",
"FontFamily": "Arial",
"FontFamilyHeading": "Consolas, Monaco",
"TabFontSize": "14",
"IconFontSize": "18",
"IconButtonWidth": "36",
"IconButtonHeight": "36",
"MicroWinLogoSize": "12",
"ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65",
Expand Down Expand Up @@ -78,13 +92,20 @@
"ShadowPulse": "0:0:3"
},
"Dark": {
"IconFontSize": "18",
"IconButtonWidth": "35",
"IconButtonHeight": "35",
"CustomDialogFontSizeHeader": "30",
"CustomDialogIconSize": "40",
"CustomDialogFontSize": "16",
"CustomDialogWidth": "450",
"CustomDialogHeight": "250",
"FontSize": "16",
"FontSizeHeading": 24,
"FontFamily": "Comic Sans MS, Comic Sans",
"FontFamilyHeading": "Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New",
"FontSizeHeading": "24",
"FontFamily": "Arial",
"FontFamilyHeading": "Consolas, Monaco",
"TabFontSize": "14",
"IconFontSize": "18",
"IconButtonWidth": "36",
"IconButtonHeight": "36",
"MicroWinLogoSize": "12",
"ComboBoxBackgroundColor": "#000000",
"LabelboxForegroundColor": "#FFEE58",
"MainForegroundColor": "#9CCC65",
Expand All @@ -93,20 +114,23 @@
"LinkForegroundColor": "#add8e6",
"LinkHoverForegroundColor": "#FFFFFF",
"ComboBoxForegroundColor": "#FFEE58",
"ButtonInstallBackgroundColor": "#222222",
"ButtonFontSize": "14",
"ButtonWidth": "200",
"ButtonHeight": "30",
"ButtonInstallBackgroundColor": "#222222",
"ButtonTweaksBackgroundColor": "#333333",
"ButtonConfigBackgroundColor": "#444444",
"ButtonUpdatesBackgroundColor": "#555555",
"ButtonInstallForegroundColor": "#FFFFFF",
"ButtonUpdatesBackgroundColor": "#555555",
"ButtonInstallForegroundColor": "#FFFFFF",
"ButtonTweaksForegroundColor": "#FFFFFF",
"ButtonConfigForegroundColor": "#FFFFFF",
"ButtonUpdatesForegroundColor": "#FFFFFF",
"ButtonUpdatesForegroundColor": "#FFFFFF",
"ButtonBackgroundColor": "#000019",
"ButtonBackgroundPressedColor": "#9CCC65",
"ButtonBackgroundMouseoverColor": "#FF5733",
"ButtonBackgroundPressedColor": "#9CCC65",
"ButtonBackgroundMouseoverColor": "#FF5733",
"ButtonBackgroundSelectedColor": "#FF5733",
"ButtonForegroundColor": "#9CCC65",
"ToggleButtonOnColor": "#2e77ff",
"ToggleButtonOnColor": "#2e77ff",
"ButtonBorderThickness": "1",
"ButtonMargin": "1",
"ButtonCornerRadius": "2",
Expand Down
22 changes: 18 additions & 4 deletions functions/private/Show-CustomDialog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@ 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
#>
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
Expand All @@ -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
Expand Down Expand Up @@ -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 = @"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ $inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme

# Read the XAML file
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
try { $sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader ) }
catch [System.Management.Automation.MethodInvocationException] {
try {
$sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader )
} catch [System.Management.Automation.MethodInvocationException] {
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
Write-Host $error[0].Exception.Message -ForegroundColor Red

If ($error[0].Exception.Message -like "*button*") {
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
}
}
catch {
} catch {
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
}

Expand Down Expand Up @@ -497,7 +498,12 @@ MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
"@
Show-CustomDialog -Message $authorInfo -Width 400
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
$IconSize = $sync.configs.themes.$ctttheme.CustomDialogIconSize
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize
})
$sync["Form"].ShowDialog() | out-null
Stop-Transcript
Loading

0 comments on commit 3254314

Please sign in to comment.