Add Get-Installed Loading Indicator + small fixes

This commit is contained in:
Marterich 2024-10-13 20:33:26 +02:00
parent 6d88e51462
commit cf664bd1d3
6 changed files with 21 additions and 47 deletions

View File

@ -20,9 +20,13 @@ function Invoke-WPFGetInstalled {
return return
} }
$preferChoco = $sync.WPFpreferChocolatey.IsChecked $preferChoco = $sync.WPFpreferChocolatey.IsChecked
$sync.ItemsControl.Dispatcher.Invoke([action]{
$sync.ItemsControl.Items | ForEach-Object { $_.Visibility = [Windows.Visibility]::Collapsed}
$null = $sync.itemsControl.Items.Add($sync.LoadingLabel)
})
Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -ParameterList @(,("ShowOnlyCheckedApps",${function:Show-OnlyCheckedApps})) -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -ParameterList @(,("ShowOnlyCheckedApps",${function:Show-OnlyCheckedApps})) -DebugPreference $DebugPreference -ScriptBlock {
param($checkbox, $preferChoco, $ShowOnlyCheckedApps,$DebugPreference) param($checkbox, $preferChoco, $ShowOnlyCheckedApps,$DebugPreference)
Write-Host $ShowOnlyCheckedApps.ToString()
$sync.ProcessRunning = $true $sync.ProcessRunning = $true
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" }) $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
@ -46,6 +50,7 @@ function Invoke-WPFGetInstalled {
}) })
$sync.ItemsControl.Dispatcher.Invoke([action]{ $sync.ItemsControl.Dispatcher.Invoke([action]{
$ShowOnlyCheckedApps.Invoke($sync.SelectedApps, $sync.ItemsControl) $ShowOnlyCheckedApps.Invoke($sync.SelectedApps, $sync.ItemsControl)
$sync.ItemsControl.Items.Remove($sync.LoadingLabel)
}) })
Write-Host "Done..." Write-Host "Done..."
$sync.ProcessRunning = $false $sync.ProcessRunning = $false

View File

@ -27,4 +27,5 @@ function Invoke-WPFTab {
$sync.$tabNav.Items[$tabNumber].IsSelected = $true $sync.$tabNav.Items[$tabNumber].IsSelected = $true
} }
} }
$sync.currentTab = $sync.$tabNav.Items[$tabNumber].Header
} }

View File

@ -50,12 +50,11 @@ function Search-AppsByNameOrDescription {
} }
function Show-OnlyCheckedApps { function Show-OnlyCheckedApps {
param ( param (
[Parameter(Mandatory=$true)] [Parameter(Mandatory=$false)]
[String[]]$appKeys, [String[]]$appKeys,
[Parameter(Mandatory=$true)] [Parameter(Mandatory=$true)]
[System.Windows.Controls.ItemsControl]$ItemsControl [System.Windows.Controls.ItemsControl]$ItemsControl
) )
Write-Host "Showing only $($appKeys.Count) apps"
$sync.ShowOnlySelected = -not $sync.ShowOnlySelected $sync.ShowOnlySelected = -not $sync.ShowOnlySelected
if ($sync.ShowOnlySelected) { if ($sync.ShowOnlySelected) {
$sync.Buttons.ShowSelectedAppsButton.Content = "Show All" $sync.Buttons.ShowSelectedAppsButton.Content = "Show All"
@ -76,7 +75,6 @@ function Invoke-WPFUIApps {
param( param(
[Parameter(Mandatory, Position = 0)] [Parameter(Mandatory, Position = 0)]
[PSCustomObject[]]$Apps, [PSCustomObject[]]$Apps,
[Parameter(Mandatory, Position = 1)] [Parameter(Mandatory, Position = 1)]
[string]$TargetGridName, [string]$TargetGridName,
[Parameter()] [Parameter()]
@ -151,9 +149,7 @@ function Invoke-WPFUIApps {
$showSelectedAppsButton.Name = "ShowSelectedAppsButton" $showSelectedAppsButton.Name = "ShowSelectedAppsButton"
$showSelectedAppsButton.Content = "Show Selected" $showSelectedAppsButton.Content = "Show Selected"
$showSelectedAppsButton.Add_Click({ $showSelectedAppsButton.Add_Click({
if ($sync.SelectedApps.Count -gt 0) { Show-OnlyCheckedApps -appKeys $sync.SelectedApps -ItemsControl $sync.ItemsControl
Show-OnlyCheckedApps -appKeys $sync.SelectedApps -ItemsControl $sync.ItemsControl
}
}) })
$sync.Buttons.ShowSelectedAppsButton = $showSelectedAppsButton $sync.Buttons.ShowSelectedAppsButton = $showSelectedAppsButton
$null = $wrapPanelTop.Children.Add($showSelectedAppsButton) $null = $wrapPanelTop.Children.Add($showSelectedAppsButton)
@ -230,12 +226,13 @@ function Invoke-WPFUIApps {
$loadingLabel.Content = "Loading, please wait..." $loadingLabel.Content = "Loading, please wait..."
$loadingLabel.HorizontalAlignment = "Center" $loadingLabel.HorizontalAlignment = "Center"
$loadingLabel.VerticalAlignment = "Center" $loadingLabel.VerticalAlignment = "Center"
$loadingLabel.FontSize = 16 $loadingLabel.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSizeHeading")
$loadingLabel.FontWeight = [Windows.FontWeights]::Bold $loadingLabel.FontWeight = [Windows.FontWeights]::Bold
$loadingLabel.Foreground = [Windows.Media.Brushes]::Gray $loadingLabel.Foreground = [Windows.Media.Brushes]::Gray
$sync.LoadingLabel = $
$itemsControl.Items.Clear() $itemsControl.Items.Clear()
$null = $itemsControl.Items.Add($loadingLabel) $null = $itemsControl.Items.Add($sync.LoadingLabel)
$itemsControl.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Background, [action]{ $itemsControl.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Background, [action]{
$itemsControl.Items.Clear() $itemsControl.Items.Clear()

View File

@ -123,9 +123,7 @@ function Invoke-WPFUIElements {
if ($configVariable -eq $sync.configs.applications) { if ($configVariable -eq $sync.configs.applications) {
# Create a WrapPanel to hold buttons at the top # Create a WrapPanel to hold buttons at the top
$wrapPanelTop = New-Object Windows.Controls.WrapPanel $wrapPanelTop = New-Object Windows.Controls.WrapPanel
$wrapPanelTop.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor") $wrapPanelTop.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
$wrapPanelTop.HorizontalAlignment = "Left" $wrapPanelTop.HorizontalAlignment = "Left"
$wrapPanelTop.VerticalAlignment = "Top" $wrapPanelTop.VerticalAlignment = "Top"
$wrapPanelTop.Orientation = "Horizontal" $wrapPanelTop.Orientation = "Horizontal"
@ -210,10 +208,8 @@ function Invoke-WPFUIElements {
$label = New-Object Windows.Controls.Label $label = New-Object Windows.Controls.Label
$label.Content = $category -replace ".*__", "" $label.Content = $category -replace ".*__", ""
$label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSizeHeading") $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSizeHeading")
$label.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily") $label.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily")
$itemsControl.Items.Add($label) | Out-Null $itemsControl.Items.Add($label) | Out-Null
$sync[$category] = $label $sync[$category] = $label
@ -234,13 +230,11 @@ function Invoke-WPFUIElements {
$border.HorizontalAlignment = "Stretch" $border.HorizontalAlignment = "Stretch"
$border.VerticalAlignment = "Top" $border.VerticalAlignment = "Top"
$border.Margin = New-Object Windows.Thickness(0, 10, 0, 0) $border.Margin = New-Object Windows.Thickness(0, 10, 0, 0)
$border.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor") $border.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
$border.Add_MouseUp({ $border.Add_MouseUp({
$childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0] $childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
$childCheckBox.isChecked = -not $childCheckbox.IsChecked $childCheckBox.isChecked = -not $childCheckbox.IsChecked
}) })
# Create a DockPanel inside the Border # Create a DockPanel inside the Border
$dockPanel = New-Object Windows.Controls.DockPanel $dockPanel = New-Object Windows.Controls.DockPanel
$dockPanel.LastChildFill = $true $dockPanel.LastChildFill = $true
@ -249,7 +243,6 @@ function Invoke-WPFUIElements {
# Create the CheckBox, vertically centered # Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox $checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name $checkBox.Name = $entryInfo.Name
$checkBox.Background = "Transparent" $checkBox.Background = "Transparent"
$checkBox.HorizontalAlignment = "Left" $checkBox.HorizontalAlignment = "Left"
$checkBox.VerticalAlignment = "Center" $checkBox.VerticalAlignment = "Center"
@ -265,7 +258,6 @@ function Invoke-WPFUIElements {
$borderElement = $this.Parent.Parent $borderElement = $this.Parent.Parent
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor") $borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
}) })
# Create a StackPanel for the image and name # Create a StackPanel for the image and name
$imageAndNamePanel = New-Object Windows.Controls.StackPanel $imageAndNamePanel = New-Object Windows.Controls.StackPanel
$imageAndNamePanel.Orientation = "Horizontal" $imageAndNamePanel.Orientation = "Horizontal"
@ -294,7 +286,6 @@ function Invoke-WPFUIElements {
$appName.FontWeight = [Windows.FontWeights]::Bold $appName.FontWeight = [Windows.FontWeights]::Bold
$appName.VerticalAlignment = "Center" $appName.VerticalAlignment = "Center"
$appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0) $appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0)
$appName.Background = "Transparent" $appName.Background = "Transparent"
$imageAndNamePanel.Children.Add($appName) | Out-Null $imageAndNamePanel.Children.Add($appName) | Out-Null
@ -323,9 +314,7 @@ function Invoke-WPFUIElements {
$installIcon.Text = [char]0xE118 # Install Icon $installIcon.Text = [char]0xE118 # Install Icon
$installIcon.FontFamily = "Segoe MDL2 Assets" $installIcon.FontFamily = "Segoe MDL2 Assets"
$installIcon.FontSize = 20 $installIcon.FontSize = 20
$installIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $installIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$installIcon.Background = "Transparent" $installIcon.Background = "Transparent"
$installIcon.HorizontalAlignment = "Center" $installIcon.HorizontalAlignment = "Center"
$installIcon.VerticalAlignment = "Center" $installIcon.VerticalAlignment = "Center"
@ -347,9 +336,7 @@ function Invoke-WPFUIElements {
$uninstallIcon.Text = [char]0xE74D # Uninstall Icon $uninstallIcon.Text = [char]0xE74D # Uninstall Icon
$uninstallIcon.FontFamily = "Segoe MDL2 Assets" $uninstallIcon.FontFamily = "Segoe MDL2 Assets"
$uninstallIcon.FontSize = 20 $uninstallIcon.FontSize = 20
$uninstallIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $uninstallIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$uninstallIcon.Background = "Transparent" $uninstallIcon.Background = "Transparent"
$uninstallIcon.HorizontalAlignment = "Center" $uninstallIcon.HorizontalAlignment = "Center"
$uninstallIcon.VerticalAlignment = "Center" $uninstallIcon.VerticalAlignment = "Center"
@ -371,9 +358,7 @@ function Invoke-WPFUIElements {
$infoIcon.Text = [char]0xE946 # Info Icon $infoIcon.Text = [char]0xE946 # Info Icon
$infoIcon.FontFamily = "Segoe MDL2 Assets" $infoIcon.FontFamily = "Segoe MDL2 Assets"
$infoIcon.FontSize = 20 $infoIcon.FontSize = 20
$infoIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $infoIcon.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$infoIcon.Background = "Transparent" $infoIcon.Background = "Transparent"
$infoIcon.HorizontalAlignment = "Center" $infoIcon.HorizontalAlignment = "Center"
$infoIcon.VerticalAlignment = "Center" $infoIcon.VerticalAlignment = "Center"
@ -431,9 +416,7 @@ function Invoke-WPFUIElements {
$label.Content = $entryInfo.Content $label.Content = $entryInfo.Content
$label.ToolTip = $entryInfo.Description $label.ToolTip = $entryInfo.Description
$label.HorizontalAlignment = "Left" $label.HorizontalAlignment = "Left"
$label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize") $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
$label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$dockPanel.Children.Add($label) | Out-Null $dockPanel.Children.Add($label) | Out-Null
$itemsControl.Items.Add($dockPanel) | Out-Null $itemsControl.Items.Add($dockPanel) | Out-Null
@ -452,18 +435,14 @@ function Invoke-WPFUIElements {
$toggleButton = New-Object Windows.Controls.ToggleButton $toggleButton = New-Object Windows.Controls.ToggleButton
$toggleButton.Name = $entryInfo.Name $toggleButton.Name = $entryInfo.Name
$toggleButton.HorizontalAlignment = "Left" $toggleButton.HorizontalAlignment = "Left"
$toggleButton.SetResourceReference([Windows.Controls.Control]::HeightProperty, "TabButtonHeight") $toggleButton.SetResourceReference([Windows.Controls.Control]::HeightProperty, "TabButtonHeight")
$toggleButton.SetResourceReference([Windows.Controls.Control]::WidthProperty, "TabButtonWidth") $toggleButton.SetResourceReference([Windows.Controls.Control]::WidthProperty, "TabButtonWidth")
$toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor") $toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor")
$toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor") $toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
$toggleButton.FontWeight = [Windows.FontWeights]::Bold $toggleButton.FontWeight = [Windows.FontWeights]::Bold
$textBlock = New-Object Windows.Controls.TextBlock $textBlock = New-Object Windows.Controls.TextBlock
$textBlock.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "TabButtonFontSize") $textBlock.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "TabButtonFontSize")
$textBlock.Background = [Windows.Media.Brushes]::Transparent $textBlock.Background = [Windows.Media.Brushes]::Transparent
$textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor") $textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor")
@ -492,14 +471,11 @@ function Invoke-WPFUIElements {
$label.Content = $entryInfo.Content $label.Content = $entryInfo.Content
$label.HorizontalAlignment = "Left" $label.HorizontalAlignment = "Left"
$label.VerticalAlignment = "Center" $label.VerticalAlignment = "Center"
$label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $label.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
$horizontalStackPanel.Children.Add($label) | Out-Null $horizontalStackPanel.Children.Add($label) | Out-Null
$comboBox = New-Object Windows.Controls.ComboBox $comboBox = New-Object Windows.Controls.ComboBox
$comboBox.Name = $entryInfo.Name $comboBox.Name = $entryInfo.Name
$comboBox.SetResourceReference([Windows.Controls.Control]::HeightProperty, "ButtonHeight") $comboBox.SetResourceReference([Windows.Controls.Control]::HeightProperty, "ButtonHeight")
$comboBox.SetResourceReference([Windows.Controls.Control]::WidthProperty, "ButtonWidth") $comboBox.SetResourceReference([Windows.Controls.Control]::WidthProperty, "ButtonWidth")
$comboBox.HorizontalAlignment = "Left" $comboBox.HorizontalAlignment = "Left"
@ -509,9 +485,7 @@ function Invoke-WPFUIElements {
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) { foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem $comboBoxItem = New-Object Windows.Controls.ComboBoxItem
$comboBoxItem.Content = $comboitem $comboBoxItem.Content = $comboitem
$comboBoxItem.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $comboBoxItem.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
$comboBox.Items.Add($comboBoxItem) | Out-Null $comboBox.Items.Add($comboBoxItem) | Out-Null
} }
@ -528,10 +502,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.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin") $button.SetResourceReference([Windows.Controls.Control]::MarginProperty, "ButtonMargin")
$button.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $button.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
if ($entryInfo.ButtonWidth) { if ($entryInfo.ButtonWidth) {
$button.Width = $entryInfo.ButtonWidth $button.Width = $entryInfo.ButtonWidth
} }
@ -560,10 +532,8 @@ function Invoke-WPFUIElements {
$radioButton.GroupName = $entryInfo.GroupName $radioButton.GroupName = $entryInfo.GroupName
$radioButton.Content = $entryInfo.Content $radioButton.Content = $entryInfo.Content
$radioButton.HorizontalAlignment = "Left" $radioButton.HorizontalAlignment = "Left"
$radioButton.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin") $radioButton.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin")
$radioButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize") $radioButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "ButtonFontSize")
$radioButton.ToolTip = $entryInfo.Description $radioButton.ToolTip = $entryInfo.Description
if ($entryInfo.Checked -eq $true) { if ($entryInfo.Checked -eq $true) {
@ -582,11 +552,9 @@ function Invoke-WPFUIElements {
$checkBox = New-Object Windows.Controls.CheckBox $checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name $checkBox.Name = $entryInfo.Name
$checkBox.Content = $entryInfo.Content $checkBox.Content = $entryInfo.Content
$checkBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize") $checkBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
$checkBox.ToolTip = $entryInfo.Description $checkBox.ToolTip = $entryInfo.Description
$checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin") $checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin")
if ($entryInfo.Checked -eq $true) { if ($entryInfo.Checked -eq $true) {
$checkBox.IsChecked = $entryInfo.Checked $checkBox.IsChecked = $entryInfo.Checked
} }

View File

@ -114,7 +114,6 @@ Invoke-WinutilThemeChange -init $true
$noimage = "https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f4e6.png" $noimage = "https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f4e6.png"
$noimage = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($noimage)) $noimage = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($noimage))
$sync.Buttons = @{} $sync.Buttons = @{}
$SortedAppsHashtable = [ordered]@{} $SortedAppsHashtable = [ordered]@{}
$sortedProperties = $sync.configs.applications.PSObject.Properties | Sort-Object { $_.Value.Content } $sortedProperties = $sync.configs.applications.PSObject.Properties | Sort-Object { $_.Value.Content }
@ -124,9 +123,9 @@ $sortedProperties | ForEach-Object {
# Now call the function with the final merged config # Now call the function with the final merged config
Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName "appscategory" -columncount 1 Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName "appscategory" -columncount 1
Invoke-WPFUIApps -Apps $SortedAppsHashtable -targetGridName "appspanel" Invoke-WPFUIApps -Apps $SortedAppsHashtable -targetGridName "appspanel"
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2 Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2 Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
@ -458,7 +457,11 @@ $sync["SearchBar"].Add_TextChanged({
} else { } else {
$sync.SearchBarClearButton.Visibility = "Collapsed" $sync.SearchBarClearButton.Visibility = "Collapsed"
} }
Search-AppsByNameOrDescription -SearchString $sync.SearchBar.Text switch ($sync.currentTab) {
"Install" {
Search-AppsByNameOrDescription -SearchString $sync.SearchBar.Text
}
}
}) })
$sync["Form"].Add_Loaded({ $sync["Form"].Add_Loaded({
@ -590,9 +593,6 @@ $sync["SponsorMenuItem"].Add_Click({
Show-CustomDialog -Message $authorInfo -EnableScroll $true Show-CustomDialog -Message $authorInfo -EnableScroll $true
}) })
#Initialize List to store the Names of the selected Apps on the Install Tab
$sync.selectedApps = [System.Collections.Generic.List[string]]::new()
$sync.ShowOnlySeleced = $false
$sync["Form"].ShowDialog() | out-null $sync["Form"].ShowDialog() | out-null

View File

@ -38,6 +38,9 @@ $sync.PSScriptRoot = $PSScriptRoot
$sync.version = "#{replaceme}" $sync.version = "#{replaceme}"
$sync.configs = @{} $sync.configs = @{}
$sync.ProcessRunning = $false $sync.ProcessRunning = $false
$sync.selectedApps = [System.Collections.Generic.List[string]]::new()
$sync.ShowOnlySeleced = $false
$sync.currentTab = "Install"
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch." Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."