Skip to content

Commit

Permalink
LETS GOOO (#12)
Browse files Browse the repository at this point in the history
* Add Selected Apps Label, Reshuffel the nesting of the checkbox and the label to be able to reference the name from the actual checkbox

* Add visual selection and allow click on the whole app section

* Fix Theme definition to work with theme change

* Fix Highlight on if label or icon is clicked

* change applications.json to powershell object list and refactor UI Creation logic

* Optimization and Add Collapsable Categories

* Add Button functionality for install, uninstall, info, install selected, uninstall selected, clear and implement search

* Rest application.json to Main

* Reset Compile to main

* Pretty much revamp_apps but without changes to applications.json

* Small fixes
  • Loading branch information
Marterich authored Oct 13, 2024
1 parent 5bbc6c6 commit 6d88e51
Show file tree
Hide file tree
Showing 8 changed files with 632 additions and 120 deletions.
4 changes: 4 additions & 0 deletions config/themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"ButtonCornerRadius": "2"
},
"Light": {
"AppInstallUnselectedColor": "#F0F0F0",
"AppInstallSelectedColor": "#C2C2C2",
"ComboBoxForegroundColor": "#232629",
"ComboBoxBackgroundColor": "#F7F7F7",
"LabelboxForegroundColor": "#232629",
Expand Down Expand Up @@ -73,6 +75,8 @@

},
"Dark": {
"AppInstallUnselectedColor": "#232629",
"AppInstallSelectedColor": "#4C4C4C",
"ComboBoxForegroundColor": "#F7F7F7",
"ComboBoxBackgroundColor": "#1E3747",
"LabelboxForegroundColor": "#0567ff",
Expand Down
14 changes: 8 additions & 6 deletions functions/public/Invoke-WPFGetInstalled.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function Invoke-WPFGetInstalled {
return
}
$preferChoco = $sync.WPFpreferChocolatey.IsChecked
Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -DebugPreference $DebugPreference -ScriptBlock {
param($checkbox, $preferChoco, $DebugPreference)

Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -ParameterList @(,("ShowOnlyCheckedApps",${function:Show-OnlyCheckedApps})) -DebugPreference $DebugPreference -ScriptBlock {
param($checkbox, $preferChoco, $ShowOnlyCheckedApps,$DebugPreference)
Write-Host $ShowOnlyCheckedApps.ToString()
$sync.ProcessRunning = $true
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })

Expand All @@ -38,13 +38,15 @@ function Invoke-WPFGetInstalled {
else{
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
}

$sync.form.Dispatcher.invoke({
foreach($checkbox in $Checkboxes) {
$sync.$checkbox.ischecked = $True
}
}
})
$sync.ItemsControl.Dispatcher.Invoke([action]{
$ShowOnlyCheckedApps.Invoke($sync.SelectedApps, $sync.ItemsControl)
})

Write-Host "Done..."
$sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" })
Expand Down
6 changes: 4 additions & 2 deletions functions/public/Invoke-WPFInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
function Invoke-WPFInstall {
param (
[Parameter(Mandatory=$false)]
[PSObject[]]$PackagesToInstall = $($sync.selectedApps | Foreach-Object { $SortedAppsHashtable.$_ })
)
<#
.SYNOPSIS
Expand All @@ -12,8 +16,6 @@ function Invoke-WPFInstall {
return
}

$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
Write-Host $PackagesToInstall
if ($PackagesToInstall.Count -eq 0) {
$WarningMsg = "Please select the program(s) to install or upgrade"
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
Expand Down
41 changes: 41 additions & 0 deletions functions/public/Invoke-WPFSelectedLabelUpdate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function Invoke-WPFSelectedLabelUpdate {
<#
.SYNOPSIS
This is a helper function that is called by the Checked and Unchecked events of the Checkboxes on the install tab.
It Updates the "Selected Apps" Label on the Install Tab to represent the current collection
.PARAMETER type
Eigther: Add | Remove
.PARAMETER checkbox
should contain the current instance of the checkbox that triggered the Event.
Most of the time will be the automatic variable $this
.EXAMPLE
$checkbox.Add_Unchecked({Invoke-WPFSelectedLabelUpdate -type "Remove" -checkbox $this})
OR
Invoke-WPFSelectedLabelUpdate -type "Add" -checkbox $specificCheckbox
#>
param (
$type,
$checkbox
)
$selectedLabel = $sync.WPFSelectedLabel
# Get the actual Name from the Label inside the Checkbox
$appKey = $checkbox.Parent.Parent.Tag
if ($type -eq "Add") {
$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)
}
else{
Write-Error "Type: $type not implemented"
}
$count = $sync.SelectedApps.Count
$SelectedLabel.Content = "Selected Apps: $count"
if ($count -gt 0) {
$SelectedLabel.ToolTip = $($sync.SelectedApps | Foreach-Object { $SortedAppsHashtable.$_.Content }) -join "`n"
} else {
$SelectedLabel.ToolTip = $Null
}
}
Loading

0 comments on commit 6d88e51

Please sign in to comment.