diff --git a/config/appnavigation.json b/config/appnavigation.json index 014a6dd8..65f701b8 100644 --- a/config/appnavigation.json +++ b/config/appnavigation.json @@ -1,4 +1,18 @@ { + "WPFGetInstalled": { + "Content": "Get Installed", + "Category": "____Navigation", + "Type": "Button", + "Order": "1", + "Description": "Show installed applications" + }, + "WPFClearInstallSelection": { + "Content": "Clear Selection", + "Category": "____Navigation", + "Type": "Button", + "Order": "2", + "Description": "Clear the selection of applications" + }, "SortbyCategory": { "Content": "Category", "Category": "___Sort by", diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 653883ec..9e4d507c 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -118,62 +118,40 @@ function Invoke-WPFUIElements { if ($configVariable -eq $sync.configs.applications) { # Create a WrapPanel to hold buttons at the top $wrapPanelTop = New-Object Windows.Controls.WrapPanel - $wrapPanelTop.Background = $window.FindResource("MainBackgroundColor") # Dynamic resource for the background + $wrapPanelTop.Background = $window.FindResource("MainBackgroundColor") $wrapPanelTop.HorizontalAlignment = "Left" $wrapPanelTop.VerticalAlignment = "Top" $wrapPanelTop.Orientation = "Horizontal" - $wrapPanelTop.Margin = $window.FindResource("TabContentMargin") # Dynamic resource for the margin + $wrapPanelTop.Margin = $window.FindResource("TabContentMargin") # Create buttons and add them to the WrapPanel with dynamic widths $installButton = New-Object Windows.Controls.Button $installButton.Name = "WPFInstall" $installButton.Content = "Install/Upgrade Selected" $installButton.Margin = New-Object Windows.Thickness(2) - $installButton.MinWidth = 100 # Minimum width to ensure readability - $installButton.MaxWidth = 200 # Max width to prevent buttons from being too large $installButton.HorizontalAlignment = "Stretch" $wrapPanelTop.Children.Add($installButton) | Out-Null + $sync["WPFInstall"] = $installButton $upgradeButton = New-Object Windows.Controls.Button $upgradeButton.Name = "WPFInstallUpgrade" $upgradeButton.Content = "Upgrade All" $upgradeButton.Margin = New-Object Windows.Thickness(2) - $upgradeButton.MinWidth = 100 - $upgradeButton.MaxWidth = 200 $upgradeButton.HorizontalAlignment = "Stretch" $wrapPanelTop.Children.Add($upgradeButton) | Out-Null + $sync["WPFInstallUpgrade"] = $upgradeButton $uninstallButton = New-Object Windows.Controls.Button $uninstallButton.Name = "WPFUninstall" $uninstallButton.Content = "Uninstall Selected" $uninstallButton.Margin = New-Object Windows.Thickness(2) - $uninstallButton.MinWidth = 100 - $uninstallButton.MaxWidth = 200 $uninstallButton.HorizontalAlignment = "Stretch" $wrapPanelTop.Children.Add($uninstallButton) | Out-Null - - $getInstalledButton = New-Object Windows.Controls.Button - $getInstalledButton.Name = "WPFGetInstalled" - $getInstalledButton.Content = "Get Installed" - $getInstalledButton.Margin = New-Object Windows.Thickness(2) - $getInstalledButton.MinWidth = 100 - $getInstalledButton.MaxWidth = 200 - $getInstalledButton.HorizontalAlignment = "Stretch" - $wrapPanelTop.Children.Add($getInstalledButton) | Out-Null - - $clearSelectionButton = New-Object Windows.Controls.Button - $clearSelectionButton.Name = "WPFClearInstallSelection" - $clearSelectionButton.Content = "Clear Selection" - $clearSelectionButton.Margin = New-Object Windows.Thickness(2) - $clearSelectionButton.MinWidth = 100 - $clearSelectionButton.MaxWidth = 200 - $clearSelectionButton.HorizontalAlignment = "Stretch" - $wrapPanelTop.Children.Add($clearSelectionButton) | Out-Null + $sync["WPFUninstall"] = $uninstallButton # Dock the WrapPanel at the top of the DockPanel [Windows.Controls.DockPanel]::SetDock($wrapPanelTop, [Windows.Controls.Dock]::Top) $dockPanelContainer.Children.Add($wrapPanelTop) | Out-Null - } # Create a ScrollViewer to contain the main content (excluding buttons)