mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-05-24 08:17:25 -05:00

* Initial Remove Expanded View * more cleanup * Add word wrapping for Tooltips * Update tooltip colors in themes and XAML styles * Rename Properties for consistency * More Cleanup, and simplification. Also added support for screenreaders * Remove unused variables and shorten window naming * Rename Invoke-WPFUIApps to Initialize-WPFUI and update function calls for consistency * Rename Invoke-WPFUIApps.ps1 to Initialize-WPFUI.ps1 * Add TODO comments for sidebar UI generation in Initialize-WPFUI function
58 lines
2.6 KiB
PowerShell
58 lines
2.6 KiB
PowerShell
function Initialize-WPFUI {
|
|
[OutputType([void])]
|
|
param(
|
|
[Parameter(Mandatory)]
|
|
[string]$TargetGridName
|
|
)
|
|
|
|
switch ($TargetGridName) {
|
|
"appscategory"{
|
|
# TODO
|
|
# Switch UI generation of the sidebar to this function
|
|
# $sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
|
|
# ...
|
|
|
|
# Create and configure a popup for displaying selected apps
|
|
$selectedAppsPopup = New-Object Windows.Controls.Primitives.Popup
|
|
$selectedAppsPopup.IsOpen = $false
|
|
$selectedAppsPopup.PlacementTarget = $sync.WPFselectedAppsButton
|
|
$selectedAppsPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
|
|
$selectedAppsPopup.AllowsTransparency = $true
|
|
|
|
# Style the popup with a border and background
|
|
$selectedAppsBorder = New-Object Windows.Controls.Border
|
|
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
|
|
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderBrushProperty, "MainForegroundColor")
|
|
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderThicknessProperty, "ButtonBorderThickness")
|
|
$selectedAppsBorder.Width = 200
|
|
$selectedAppsBorder.Padding = 5
|
|
$selectedAppsPopup.Child = $selectedAppsBorder
|
|
$sync.selectedAppsPopup = $selectedAppsPopup
|
|
|
|
# Add a stack panel inside the popup's border to organize its child elements
|
|
$sync.selectedAppsstackPanel = New-Object Windows.Controls.StackPanel
|
|
$selectedAppsBorder.Child = $sync.selectedAppsstackPanel
|
|
|
|
# Close selectedAppsPopup when mouse leaves both button and selectedAppsPopup
|
|
$sync.WPFselectedAppsButton.Add_MouseLeave({
|
|
if (-not $sync.selectedAppsPopup.IsMouseOver) {
|
|
$sync.selectedAppsPopup.IsOpen = $false
|
|
}
|
|
})
|
|
$selectedAppsPopup.Add_MouseLeave({
|
|
if (-not $sync.WPFselectedAppsButton.IsMouseOver) {
|
|
$sync.selectedAppsPopup.IsOpen = $false
|
|
}
|
|
})
|
|
}
|
|
"appspanel" {
|
|
$sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
|
|
Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $sync.configs.applicationsHashtable
|
|
}
|
|
default {
|
|
Write-Output "$TargetGridName not yet implemented"
|
|
}
|
|
}
|
|
}
|
|
|