From a22d6b0d107993904b23040670eddfcf949eb3ff Mon Sep 17 00:00:00 2001 From: MyDrift Date: Thu, 15 Aug 2024 23:53:05 +0200 Subject: [PATCH] cleanup --- config/themes.json | 4 +- functions/public/Invoke-WPFUIElements.ps1 | 24 ++------ xaml/inputXML.xaml | 73 ++++++++++++++++------- 3 files changed, 56 insertions(+), 45 deletions(-) diff --git a/config/themes.json b/config/themes.json index e5b4be14..c7cc0b93 100644 --- a/config/themes.json +++ b/config/themes.json @@ -86,7 +86,7 @@ "HeaderFontFamily": "Consolas, Monaco", "CheckBoxBulletDecoratorFontSize": "14", - "CheckBoxMargin": "5,0,0,2", + "CheckBoxMargin": "5,0,0,1", "TabButtonFontSize": "14", "TabButtonWidth": "100", @@ -158,7 +158,7 @@ "HeaderFontFamily": "Consolas, Monaco", "CheckBoxBulletDecoratorFontSize": "14", - "CheckBoxMargin": "5,0,0,2", + "CheckBoxMargin": "5,0,0,0.8", "TabButtonFontSize": "14", "TabButtonWidth": "100", diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index f92e6f3d..6049864f 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -48,7 +48,7 @@ function Invoke-WPFUIElements { Content = $entryInfo.Content Choco = $entryInfo.choco Winget = $entryInfo.winget - Panel = if ($entryInfo.Panel -ne $null) { $entryInfo.Panel } else { "0" } + Panel = if ($entryInfo.Panel) { $entryInfo.Panel } else { "0" } Link = $entryInfo.link Description = $entryInfo.description Type = $entryInfo.type @@ -222,17 +222,6 @@ function Invoke-WPFUIElements { $sync[$entryInfo.Name] = $toggleButton } - "Image" { - $image = New-Object Windows.Controls.Image - $image.Name = $entryInfo.Name - $image.Source = $entryInfo.Content - $image.Height = $theme.ImageHeight - $image.Width = $theme.ImageWidth - $image.HorizontalAlignment = "Center" - $image.Margin = $theme.ImageMargin - $stackPanel.Children.Add($image) | Out-Null - } - "Combobox" { $horizontalStackPanel = New-Object Windows.Controls.StackPanel $horizontalStackPanel.Orientation = "Horizontal" @@ -276,17 +265,12 @@ function Invoke-WPFUIElements { $button.Margin = "5" $button.Padding = "20,5" $button.FontSize = $theme.ButtonFontSize - if ($entryInfo.ButtonWidth -ne $null) { + if ($entryInfo.ButtonWidth) { $button.Width = $entryInfo.ButtonWidth } $stackPanel.Children.Add($button) | Out-Null $sync[$entryInfo.Name] = $button - - $sync[$entryInfo.Name].Add_Click({ - [System.Object]$Sender = $args[0] - Invoke-WPFButton $Sender.name - }) } default { @@ -299,12 +283,12 @@ function Invoke-WPFUIElements { $checkBox.FontSize = $theme.FontSize $checkBox.ToolTip = $entryInfo.Description $checkBox.Margin = $theme.CheckBoxMargin - if ($entryInfo.Checked -ne $null) { + if ($entryInfo.Checked) { $checkBox.IsChecked = $entryInfo.Checked } $horizontalStackPanel.Children.Add($checkBox) | Out-Null - if ($entryInfo.Link -ne $null) { + if ($entryInfo.Link) { $textBlock = New-Object Windows.Controls.TextBlock $textBlock.Name = $checkBox.Name + "Link" $textBlock.Text = "(?)" diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 3daf444b..2673b076 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -773,32 +773,59 @@ - - + + - - - + + - -