diff --git a/functions/private/Add-SelectedAppsMenuItem.ps1 b/functions/private/Add-SelectedAppsMenuItem.ps1 index 58183792..29789c20 100644 --- a/functions/private/Add-SelectedAppsMenuItem.ps1 +++ b/functions/private/Add-SelectedAppsMenuItem.ps1 @@ -1,23 +1,23 @@ function Add-SelectedAppsMenuItem { <# - .SYNOPSIS + .SYNOPSIS This is a helper function that generates and adds the Menu Items to the Selected Apps Popup. - + .Parameter name The actual Name of an App like "Chrome" or "Brave" This name is contained in the "Content" property inside the applications.json .PARAMETER key - The key which identifies an app object in applications.json - For Chrome this would be "WPFInstallchrome" because "WPFInstall" is prepended automatically for each key in applications.json + The key which identifies an app object in applications.json + For Chrome this would be "WPFInstallchrome" because "WPFInstall" is prepended automatically for each key in applications.json #> param ([string]$name, [string]$key) - + $selectedAppGrid = New-Object Windows.Controls.Grid $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "*"})) $selectedAppGrid.ColumnDefinitions.Add((New-Object System.Windows.Controls.ColumnDefinition -Property @{Width = "30"})) - + # Sets the name to the Content as well as the Tooltip, because the parent Popup Border has a fixed width and text could "overflow". # With the tooltip, you can still read the whole entry on hover $selectedAppLabel = New-Object Windows.Controls.Label @@ -30,13 +30,13 @@ $selectedAppRemoveButton = New-Object Windows.Controls.Button $selectedAppRemoveButton.FontFamily = "Segoe MDL2 Assets" - $selectedAppRemoveButton.Content = [string]([char]0xE711) + $selectedAppRemoveButton.Content = [string]([char]0xE711) $selectedAppRemoveButton.HorizontalAlignment = "Center" $selectedAppRemoveButton.Tag = $key $selectedAppRemoveButton.ToolTip = "Remove the App from Selection" $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $selectedAppRemoveButton.SetResourceReference([Windows.Controls.Control]::StyleProperty, "HoverButtonStyle") - + # Highlight the Remove icon on Hover $selectedAppRemoveButton.Add_MouseEnter({ $this.Foreground = "Red" }) $selectedAppRemoveButton.Add_MouseLeave({ $this.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") }) @@ -46,5 +46,5 @@ [System.Windows.Controls.Grid]::SetColumn($selectedAppRemoveButton, 1) $selectedAppGrid.Children.Add($selectedAppRemoveButton) # Add new Element to Popup - $sync.selectedAppsstackPanel.Children.Add($selectedAppGrid) - } \ No newline at end of file + $sync.selectedAppsstackPanel.Children.Add($selectedAppGrid) + } diff --git a/functions/private/Find-AppsByNameOrDescription.ps1 b/functions/private/Find-AppsByNameOrDescription.ps1 index 21b777ac..4271835f 100644 --- a/functions/private/Find-AppsByNameOrDescription.ps1 +++ b/functions/private/Find-AppsByNameOrDescription.ps1 @@ -1,14 +1,14 @@ function Find-AppsByNameOrDescription { <# - .SYNOPSIS + .SYNOPSIS Searches through the Apps on the Install Tab and hides all entries that do not match the string - + .PARAMETER SearchString The string to be searched for #> param( [Parameter(Mandatory=$false)] - [string]$SearchString = "" + [string]$SearchString = "" ) # Reset the visibility if the search string is empty or the search is cleared if ([string]::IsNullOrWhiteSpace($SearchString)) { @@ -31,5 +31,5 @@ function Find-AppsByNameOrDescription { } } } - } -} \ No newline at end of file + } +} diff --git a/functions/private/Initalize-InstallAppEntry.ps1 b/functions/private/Initalize-InstallAppEntry.ps1 index 8ac1379f..47268a18 100644 --- a/functions/private/Initalize-InstallAppEntry.ps1 +++ b/functions/private/Initalize-InstallAppEntry.ps1 @@ -1,12 +1,12 @@ function Initialize-InstallAppEntry { <# .SYNOPSIS - Creates the app entry to be placed on the isntall tab for a given app + Creates the app entry to be placed on the isntall tab for a given app Used to as part of the Install Tab UI generation .PARAMETER TargetElement The Element into which the Apps should be placed .PARAMETER AppKey - The Key of the app inside the $sync.configs.applicationsHashtable + The Key of the app inside the $sync.configs.applicationsHashtable #> param( [Windows.Controls.WrapPanel]$TargetElement, @@ -194,4 +194,4 @@ function Initialize-InstallAppEntry { # Add the border to the corresponding Category $TargetElement.Children.Add($border) | Out-Null - } \ No newline at end of file + } diff --git a/functions/private/Initialize-InstallAppArea.ps1 b/functions/private/Initialize-InstallAppArea.ps1 index 0e4650f0..3e79d56d 100644 --- a/functions/private/Initialize-InstallAppArea.ps1 +++ b/functions/private/Initialize-InstallAppArea.ps1 @@ -2,11 +2,11 @@ <# .SYNOPSIS Creates a [Windows.Controls.ScrollViewer] containing a [Windows.Controls.ItemsControl] which is setup to use Virtualization to only load the visible elements for performance reasons. - This is used as the parent object for all category and app entries on the install tab + This is used as the parent object for all category and app entries on the install tab Used to as part of the Install Tab UI generation - + .PARAMETER TargetElement - The element to which the AppArea shoud be added + The element to which the AppArea shoud be added #> param($TargetElement) @@ -33,4 +33,4 @@ [Windows.Controls.DockPanel]::SetDock($scrollViewer, [Windows.Controls.Dock]::Bottom) $null = $TargetElement.Children.Add($scrollViewer) return $itemsControl - } \ No newline at end of file + } diff --git a/functions/private/Initialize-InstallAppsMainElement.ps1 b/functions/private/Initialize-InstallAppsMainElement.ps1 index 38b425c8..818a6343 100644 --- a/functions/private/Initialize-InstallAppsMainElement.ps1 +++ b/functions/private/Initialize-InstallAppsMainElement.ps1 @@ -4,7 +4,7 @@ function Initialize-InstallAppsMainElement { Clears the given WPF Grid and creates a [Windows.Controls.Border] containing a [Windows.Controls.StackPanel] Used to as part of the Install Tab UI generation .PARAMETER TargetGridName - The WPF Grid name + The WPF Grid name .OUTPUTS Returns the created [Windows.Controls.StackPanel] element #> @@ -12,7 +12,7 @@ function Initialize-InstallAppsMainElement { [Parameter(Mandatory)] [string]$TargetGridName ) - $targetGrid = $sync.Form.FindName($TargetGridName) + $targetGrid = $sync.Form.FindName($TargetGridName) $null = $targetGrid.Children.Clear() $Border = New-Object Windows.Controls.Border @@ -25,4 +25,4 @@ function Initialize-InstallAppsMainElement { $null = $targetGrid.Children.Add($Border) return $dockPanel -} \ No newline at end of file +} diff --git a/functions/private/Initialize-InstallCategoryAppList.ps1 b/functions/private/Initialize-InstallCategoryAppList.ps1 index 4ab1b28e..aa5151e0 100644 --- a/functions/private/Initialize-InstallCategoryAppList.ps1 +++ b/functions/private/Initialize-InstallCategoryAppList.ps1 @@ -2,14 +2,14 @@ function Initialize-InstallCategoryAppList { <# .SYNOPSIS Clears the Target Element and sets up a "Loading" message. This is done, because loading of all apps can take a bit of time in some scenarios - Iterates through all Categories and Apps and adds them to the UI + Iterates through all Categories and Apps and adds them to the UI Used to as part of the Install Tab UI generation .PARAMETER TargetElement The Element into which the Categories and Apps should be placed .PARAMETER Apps The Hashtable of Apps to be added to the UI The Categories are also extracted from the Apps Hashtable - + #> param( $TargetElement, @@ -20,7 +20,7 @@ function Initialize-InstallCategoryAppList { [string]$Category, [Windows.Controls.ItemsControl]$TargetElement ) - + $toggleButton = New-Object Windows.Controls.Primitives.ToggleButton $toggleButton.Content = "$Category" $toggleButton.Tag = "CategoryToggleButton" @@ -51,7 +51,7 @@ function Initialize-InstallCategoryAppList { $null = $TargetElement.Items.Add($sync.LoadingLabel) # Use the Dispatcher to make sure the Loading message is shown before the logic loading the apps starts, and only is removed when the loading is complete and the apps are added to the UI $TargetElement.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Background, [action]{ - + $TargetElement.Items.Clear() # Remove the loading message $categories = $Apps.Values | Select-Object -ExpandProperty category -Unique | Sort-Object foreach ($category in $categories) { @@ -69,4 +69,4 @@ function Initialize-InstallCategoryAppList { } } }) - } \ No newline at end of file + } diff --git a/functions/private/Initialize-InstallHeader.ps1 b/functions/private/Initialize-InstallHeader.ps1 index 1ea1d7fc..2e70533d 100644 --- a/functions/private/Initialize-InstallHeader.ps1 +++ b/functions/private/Initialize-InstallHeader.ps1 @@ -46,7 +46,7 @@ function Initialize-InstallHeader { $selectedAppsButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $selectedAppsButton.HorizontalAlignment = "Center" $selectedAppsButton.VerticalAlignment = "Center" - + $selectedAppsPopup = New-Object Windows.Controls.Primitives.Popup $selectedAppsPopup.IsOpen = $false $selectedAppsPopup.PlacementTarget = $selectedAppsButton @@ -61,7 +61,7 @@ function Initialize-InstallHeader { $selectedAppsBorder.Padding = 5 $selectedAppsPopup.Child = $selectedAppsBorder $sync.selectedAppsPopup = $selectedAppsPopup - + $sync.selectedAppsstackPanel = New-Object Windows.Controls.StackPanel $selectedAppsBorder.Child = $sync.selectedAppsstackPanel @@ -86,4 +86,4 @@ function Initialize-InstallHeader { [Windows.Controls.DockPanel]::SetDock($wrapPanelTop, [Windows.Controls.Dock]::Top) $null = $TargetElement.Children.Add($wrapPanelTop) -} \ No newline at end of file +} diff --git a/functions/private/Set-CategoryVisibility.ps1 b/functions/private/Set-CategoryVisibility.ps1 index 2d2bdc93..4d2c48d0 100644 --- a/functions/private/Set-CategoryVisibility.ps1 +++ b/functions/private/Set-CategoryVisibility.ps1 @@ -2,10 +2,10 @@ function Set-CategoryVisibility { <# .SYNOPSIS Used to expand or collapse categories and corresponding apps on the install tab - + .PARAMETER Category Can eigther be a specific category name like "Browsers" OR "*" to affect all categories at once - + .PARAMETER overrideState "Expand" => expands the corresponding elements "Collapse" => collapses the corresponding elements @@ -17,8 +17,8 @@ function Set-CategoryVisibility { [ValidateSet("Expand", "Collapse")] [string]$overrideState ) - - switch ($overrideState){ + + switch ($overrideState) { "Expand" {$state = $true} "Collapse" {$state = $false} default {$state = $sync.CompactView} @@ -29,7 +29,7 @@ function Set-CategoryVisibility { if ($category -eq "*") { $items = $sync.ItemsControl.Items | Where-Object {($_.Tag -like "CategoryWrapPanel_*")} $sync.ItemsControl.Items | Where-Object {($_.Tag -eq "CategoryToggleButton")} | Foreach-Object { $_.Visibility = [Windows.Visibility]::Visible; $_.IsChecked = $state } - + } else { $items = $sync.ItemsControl.Items | Where-Object {($_.Tag -eq "CategoryWrapPanel_$Category")} } @@ -41,4 +41,4 @@ function Set-CategoryVisibility { $items.Children | ForEach-Object { $_.Visibility = $elementVisibility } -} \ No newline at end of file +} diff --git a/functions/private/Show-OnlyCheckedApps.ps1 b/functions/private/Show-OnlyCheckedApps.ps1 index 55dc2fb3..fc581cb0 100644 --- a/functions/private/Show-OnlyCheckedApps.ps1 +++ b/functions/private/Show-OnlyCheckedApps.ps1 @@ -51,4 +51,4 @@ function Show-OnlyCheckedApps { } Set-CategoryVisibility -Category "*" } -} \ No newline at end of file +} diff --git a/functions/public/Invoke-WPFSelectedAppsUpdate.ps1 b/functions/public/Invoke-WPFSelectedAppsUpdate.ps1 index de60912f..19e39a4a 100644 --- a/functions/public/Invoke-WPFSelectedAppsUpdate.ps1 +++ b/functions/public/Invoke-WPFSelectedAppsUpdate.ps1 @@ -25,7 +25,7 @@ function Invoke-WPFSelectedAppsUpdate { $sync.selectedApps.Add($appKey) # The List type needs to be specified again, because otherwise Sort-Object will convert the list to a string if there is only a single entry [System.Collections.Generic.List[pscustomobject]]$sync.selectedApps = $sync.SelectedApps | Sort-Object - + } elseif ($type -eq "Remove") { $sync.SelectedApps.Remove($appKey) @@ -33,11 +33,11 @@ function Invoke-WPFSelectedAppsUpdate { else{ Write-Error "Type: $type not implemented" } - + $count = $sync.SelectedApps.Count $selectedAppsButton.Content = "Selected Apps: $count" # On every change, remove all entries inside the Popup Menu. This is done, so we can keep the alphabetical order even if elements are selected in a random way - $sync.selectedAppsstackPanel.Children.Clear() + $sync.selectedAppsstackPanel.Children.Clear() $sync.SelectedApps | Foreach-Object { Add-SelectedAppsMenuItem -name $($sync.configs.applicationsHashtable.$_.Content) -key $_ } - + } diff --git a/functions/public/Invoke-WPFUIApps.ps1 b/functions/public/Invoke-WPFUIApps.ps1 index e3d53929..e339277f 100644 --- a/functions/public/Invoke-WPFUIApps.ps1 +++ b/functions/public/Invoke-WPFUIApps.ps1 @@ -10,7 +10,7 @@ function Invoke-WPFUIApps { switch ($TargetGridName) { "appspanel" { $dockPanel = Initialize-InstallAppsMainElement -TargetGridName $TargetGridName - $null = Initialize-InstallHeader -TargetElement $dockPanel + $null = Initialize-InstallHeader -TargetElement $dockPanel $sync.ItemsControl = Initialize-InstallAppArea -TargetElement $dockPanel Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $Apps }