Compare commits

..

No commits in common. "1c2b30161340e8671f9d24af6f47fc798c91fcb8" and "18466bc496453550748240b64b06f4fcc6c181ef" have entirely different histories.

4 changed files with 41 additions and 55 deletions

View File

@ -12,9 +12,8 @@
"HeaderFontFamily": "Consolas, Monaco", "HeaderFontFamily": "Consolas, Monaco",
"CheckBoxBulletDecoratorFontSize": "14", "CheckBoxBulletDecoratorFontSize": "14",
"CheckBoxMargin": "5,0,0,1", "CheckBoxMargin": "5,0,0,2",
"TabContentMargin": "5",
"TabButtonFontSize": "14", "TabButtonFontSize": "14",
"TabButtonWidth": "100", "TabButtonWidth": "100",
"TabButtonHeight": "25", "TabButtonHeight": "25",
@ -89,7 +88,6 @@
"CheckBoxBulletDecoratorFontSize": "14", "CheckBoxBulletDecoratorFontSize": "14",
"CheckBoxMargin": "5,0,0,1", "CheckBoxMargin": "5,0,0,1",
"TabContentMargin": "5",
"TabButtonFontSize": "14", "TabButtonFontSize": "14",
"TabButtonWidth": "100", "TabButtonWidth": "100",
"TabButtonHeight": "25", "TabButtonHeight": "25",
@ -160,9 +158,8 @@
"HeaderFontFamily": "Consolas, Monaco", "HeaderFontFamily": "Consolas, Monaco",
"CheckBoxBulletDecoratorFontSize": "14", "CheckBoxBulletDecoratorFontSize": "14",
"CheckBoxMargin": "5,0,0,1", "CheckBoxMargin": "5,0,0,0.8",
"TabContentMargin": "5",
"TabButtonFontSize": "14", "TabButtonFontSize": "14",
"TabButtonWidth": "100", "TabButtonWidth": "100",
"TabButtonHeight": "25", "TabButtonHeight": "25",

View File

@ -25,29 +25,7 @@ function Invoke-WPFUIElements {
[int]$columncount [int]$columncount
) )
$window = $sync["Form"]
$theme = $sync.configs.themes.$ctttheme $theme = $sync.configs.themes.$ctttheme
$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)
# 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 # Convert PSCustomObject to Hashtable
$configHashtable = @{} $configHashtable = @{}
@ -87,6 +65,22 @@ function Invoke-WPFUIElements {
# Store application data in an array under the category # Store application data in an array under the category
$organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject $organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject
}
# Retrieve the main window and the target Grid by name
$window = $sync["Form"]
$targetGrid = $window.FindName($targetGridName)
# 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
}
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel" # Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
if ($targetGridName -eq "appspanel") { if ($targetGridName -eq "appspanel") {
@ -94,7 +88,6 @@ function Invoke-WPFUIElements {
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count $entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
$maxcount = [Math]::Round($entrycount / $columncount + 0.5) $maxcount = [Math]::Round($entrycount / $columncount + 0.5)
} }
}
# Iterate through 'organizedData' by panel, category, and application # Iterate through 'organizedData' by panel, category, and application
$count = 0 $count = 0
@ -103,7 +96,7 @@ function Invoke-WPFUIElements {
$border = New-Object Windows.Controls.Border $border = New-Object Windows.Controls.Border
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically $border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount) [System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
$border.style = $borderstyle $border.style = $window.FindResource("BorderStyle")
$targetGrid.Children.Add($border) | Out-Null $targetGrid.Children.Add($border) | Out-Null
# Create a StackPanel inside the Border # Create a StackPanel inside the Border
@ -123,7 +116,7 @@ function Invoke-WPFUIElements {
$border = New-Object Windows.Controls.Border $border = New-Object Windows.Controls.Border
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically $border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount) [System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
$border.style = $borderstyle $border.style = $window.FindResource("BorderStyle")
$targetGrid.Children.Add($border) | Out-Null $targetGrid.Children.Add($border) | Out-Null
# Create a new StackPanel inside the Border # Create a new StackPanel inside the Border
@ -155,7 +148,7 @@ function Invoke-WPFUIElements {
$border = New-Object Windows.Controls.Border $border = New-Object Windows.Controls.Border
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically $border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount) [System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
$border.style = $borderstyle $border.style = $window.FindResource("BorderStyle")
$targetGrid.Children.Add($border) | Out-Null $targetGrid.Children.Add($border) | Out-Null
# Create a new StackPanel inside the Border # Create a new StackPanel inside the Border
@ -175,7 +168,7 @@ function Invoke-WPFUIElements {
$checkBox.Name = $entryInfo.Name $checkBox.Name = $entryInfo.Name
$checkBox.HorizontalAlignment = "Right" $checkBox.HorizontalAlignment = "Right"
$dockPanel.Children.Add($checkBox) | Out-Null $dockPanel.Children.Add($checkBox) | Out-Null
$checkBox.Style = $ColorfulToggleSwitchStyle $checkBox.Style = $window.FindResource("ColorfulToggleSwitchStyle")
$label = New-Object Windows.Controls.Label $label = New-Object Windows.Controls.Label
$label.Content = $entryInfo.Content $label.Content = $entryInfo.Content
@ -245,7 +238,7 @@ function Invoke-WPFUIElements {
$comboBox.Width = $theme.ButtonWidth $comboBox.Width = $theme.ButtonWidth
$comboBox.HorizontalAlignment = "Left" $comboBox.HorizontalAlignment = "Left"
$comboBox.VerticalAlignment = "Center" $comboBox.VerticalAlignment = "Center"
$comboBox.Margin = $theme.ButtonMargin $comboBox.Margin = "5,5"
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) { foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem $comboBoxItem = New-Object Windows.Controls.ComboBoxItem
@ -267,7 +260,8 @@ function Invoke-WPFUIElements {
$button.Name = $entryInfo.Name $button.Name = $entryInfo.Name
$button.Content = $entryInfo.Content $button.Content = $entryInfo.Content
$button.HorizontalAlignment = "Left" $button.HorizontalAlignment = "Left"
$button.Margin = $theme.ButtonMargin $button.Margin = "5"
$button.Padding = "20,5"
$button.FontSize = $theme.ButtonFontSize $button.FontSize = $theme.ButtonFontSize
if ($entryInfo.ButtonWidth) { if ($entryInfo.ButtonWidth) {
$button.Width = $entryInfo.ButtonWidth $button.Width = $entryInfo.ButtonWidth
@ -297,7 +291,7 @@ function Invoke-WPFUIElements {
$textBlock.Name = $checkBox.Name + "Link" $textBlock.Name = $checkBox.Name + "Link"
$textBlock.Text = "(?)" $textBlock.Text = "(?)"
$textBlock.ToolTip = $entryInfo.Link $textBlock.ToolTip = $entryInfo.Link
$textBlock.Style = $HoverTextBlockStyle $textBlock.Style = $window.FindResource("HoverTextBlockStyle")
# Add event handler for click to open link # Add event handler for click to open link
$handler = [System.Windows.Input.MouseButtonEventHandler]{ $handler = [System.Windows.Input.MouseButtonEventHandler]{

View File

@ -84,15 +84,10 @@ try {
# Load the configuration files # Load the configuration files
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid" #Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
$sync.form.Dispatcher.Invoke([action] {
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5 Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
})
$sync.form.Dispatcher.Invoke([action] {
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2 Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
})
$sync.form.Dispatcher.Invoke([action] {
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2 Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
})
#=========================================================================== #===========================================================================
# Store Form Objects In PowerShell # Store Form Objects In PowerShell

View File

@ -787,7 +787,7 @@
<RowDefinition Height="45px"/> <RowDefinition Height="45px"/>
<RowDefinition Height="0.95*"/> <RowDefinition Height="0.95*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="{TabContentMargin}"> <StackPanel Background="{MainBackgroundColor}" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="0" Grid.ColumnSpan="3" Margin="5">
<Button Name="WPFinstall" Content=" Install/Upgrade Selected" Margin="2" /> <Button Name="WPFinstall" Content=" Install/Upgrade Selected" Margin="2" />
<Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/> <Button Name="WPFInstallUpgrade" Content=" Upgrade All" Margin="2"/>
<Button Name="WPFuninstall" Content=" Uninstall Selected" Margin="2"/> <Button Name="WPFuninstall" Content=" Uninstall Selected" Margin="2"/>
@ -795,7 +795,7 @@
<Button Name="WPFclearWinget" Content=" Clear Selection" Margin="2"/> <Button Name="WPFclearWinget" Content=" Clear Selection" Margin="2"/>
</StackPanel> </StackPanel>
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Margin="{TabContentMargin}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" <ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.Column="0" Padding="-1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="appspanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid Name="appspanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
</Grid> </Grid>
@ -813,7 +813,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="0" Margin="{TabContentMargin}"> <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="0">
<Grid Background="Transparent"> <Grid Background="Transparent">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="45px"/> <RowDefinition Height="45px"/>
@ -846,13 +846,13 @@
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Config" Visibility="Collapsed" Name="WPFTab3"> <TabItem Header="Config" Visibility="Collapsed" Name="WPFTab3">
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{TabContentMargin}"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Name="featurespanel" Grid.Row="1" Background="Transparent"> <Grid Name="featurespanel" Grid.Row="1" Background="Transparent">
</Grid> </Grid>
</ScrollViewer> </ScrollViewer>
</TabItem> </TabItem>
<TabItem Header="Updates" Visibility="Collapsed" Name="WPFTab4"> <TabItem Header="Updates" Visibility="Collapsed" Name="WPFTab4">
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{TabContentMargin}"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Background="Transparent"> <Grid Background="Transparent">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@ -882,7 +882,7 @@
</ScrollViewer> </ScrollViewer>
</TabItem> </TabItem>
<TabItem Header="MicroWin" Visibility="Collapsed" Name="WPFTab5"> <TabItem Header="MicroWin" Visibility="Collapsed" Name="WPFTab5">
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{TabContentMargin}"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Width="Auto" Height="Auto"> <Grid Width="Auto" Height="Auto">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>