Skip to content

Commit eac886c

Browse files
committed
Active/Missing List/Lists colored Status
1 parent 32c27a5 commit eac886c

File tree

1 file changed

+70
-13
lines changed

1 file changed

+70
-13
lines changed

Sources/Winget-AutoUpdate/WAU-Settings-GUI.ps1

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,58 @@ function Update-WAUGUIFromConfig {
590590
$Controls.RunDate.Text = "Last Run: Never | "
591591
}
592592
} catch {
593-
$Controls.RunDate.Text = "Last Run: Unknown | "
593+
$Controls.RunDate.Text = "Last Run: Unknown! | "
594594
}
595595
$Controls.WinGetVersion.Text = "WinGet Version: $Script:WINGET_VERSION"
596-
$Controls.InstallLocationText.Text = "Install Location: $($updatedConfig.InstallLocation)"
596+
$Controls.InstallLocationText.Text = "Install Location: $($updatedConfig.InstallLocation) | "
597+
try {
598+
$installdir = $updatedConfig.InstallLocation
599+
if ($updatedConfig.WAU_UseWhiteList -eq 1) {
600+
$whiteListFile = Join-Path $installdir 'included_apps.txt'
601+
if (Test-Path $whiteListFile) {
602+
$Controls.ActiveListText.Inlines.Clear()
603+
$Controls.ActiveListText.Inlines.Add("Active List: ")
604+
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'")
605+
$run.Foreground = $Script:COLOR_ENABLED
606+
$Controls.ActiveListText.Inlines.Add($run)
607+
} else {
608+
$Controls.ActiveListText.Inlines.Clear()
609+
$Controls.ActiveListText.Inlines.Add("Missing List: ")
610+
$run = New-Object System.Windows.Documents.Run("'included_apps.txt'!")
611+
$run.Foreground = $Script:COLOR_DISABLED
612+
$Controls.ActiveListText.Inlines.Add($run)
613+
}
614+
} else {
615+
$excludedFile = Join-Path $installdir 'excluded_apps.txt'
616+
$defaultExcludedFile = Join-Path $installdir 'config\default_excluded_apps.txt'
617+
if (Test-Path $excludedFile) {
618+
$Controls.ActiveListText.Inlines.Clear()
619+
$Controls.ActiveListText.Inlines.Add("Active List: ")
620+
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt'")
621+
$run.Foreground = $Script:COLOR_ENABLED
622+
$Controls.ActiveListText.Inlines.Add($run)
623+
} elseif (Test-Path $defaultExcludedFile) {
624+
$Controls.ActiveListText.Inlines.Clear()
625+
$Controls.ActiveListText.Inlines.Add("Active List: ")
626+
$run = New-Object System.Windows.Documents.Run("'config\default_excluded_apps.txt'")
627+
$run.Foreground = "Orange"
628+
$Controls.ActiveListText.Inlines.Add($run)
629+
} else {
630+
$Controls.ActiveListText.Inlines.Clear()
631+
$Controls.ActiveListText.Inlines.Add("Missing Lists: ")
632+
$run = New-Object System.Windows.Documents.Run("'excluded_apps.txt' and 'config\default_excluded_apps.txt'!")
633+
$run.Foreground = $Script:COLOR_DISABLED
634+
$Controls.ActiveListText.Inlines.Add($run)
635+
}
636+
}
637+
}
638+
catch {
639+
$Controls.ActiveListText.Inlines.Clear()
640+
$Controls.ActiveListText.Inlines.Add("Active List: ")
641+
$run = New-Object System.Windows.Documents.Run("Unknown!")
642+
$run.Foreground = $Script:COLOR_INACTIVE
643+
$Controls.ActiveListText.Inlines.Add($run)
644+
}
597645

598646
# Update WAU AutoUpdate status
599647
$wauAutoUpdateDisabled = ($updatedConfig.WAU_DisableAutoUpdate -eq 1)
@@ -895,7 +943,11 @@ function Show-WAUSettingsGUI {
895943
<TextBlock x:Name="RunDate" Text="Last Run: " FontSize="9"/>
896944
<TextBlock x:Name="WinGetVersion" Text="WinGet Version: " FontSize="9"/>
897945
</StackPanel>
898-
<TextBlock x:Name="InstallLocationText" Text="Install Location: " FontSize="9"/>
946+
<StackPanel Orientation="Horizontal">
947+
<TextBlock x:Name="InstallLocationText" Text="Install Location: " FontSize="9"/>
948+
<TextBlock x:Name="ActiveListText" Text="Active List: " FontSize="9"/>
949+
</StackPanel>
950+
899951
<TextBlock x:Name="WAUAutoUpdateText" Text="WAU AutoUpdate: " FontSize="9"/>
900952
</StackPanel>
901953
</GroupBox>
@@ -1068,26 +1120,28 @@ function Show-WAUSettingsGUI {
10681120
$controls.DevListButton.Add_Click({
10691121
try {
10701122
$updatedConfig = Get-WAUCurrentConfig
1071-
$installDir = $updatedConfig.InstallLocation
1123+
$installdir = $updatedConfig.InstallLocation
10721124
if ($updatedConfig.WAU_UseWhiteList -eq 1) {
1073-
$whiteListFile = Join-Path $installDir 'included_apps.txt'
1125+
$whiteListFile = Join-Path $installdir 'included_apps.txt'
10741126
if (Test-Path $whiteListFile) {
1075-
Start-PopUp "WAU Whitelist opening..."
1127+
Start-PopUp "WAU Included Apps List opening..."
10761128
Start-Process "explorer.exe" -ArgumentList $whiteListFile
10771129
} else {
1078-
[System.Windows.MessageBox]::Show("'included_apps.txt' not found in $installDir", "File Not Found", "OK", "Warning")
1130+
[System.Windows.MessageBox]::Show("No Included Apps List found ('included_apps.txt')", "File Not Found", "OK", "Warning")
1131+
return
10791132
}
10801133
} else {
1081-
$excludedFile = Join-Path $installDir 'excluded_apps.txt'
1082-
$defaultExcludedFile = Join-Path $installDir 'config\default_excluded_apps.txt'
1134+
$excludedFile = Join-Path $installdir 'excluded_apps.txt'
1135+
$defaultExcludedFile = Join-Path $installdir 'config\default_excluded_apps.txt'
10831136
if (Test-Path $excludedFile) {
1084-
Start-PopUp "WAU Blacklist opening..."
1137+
Start-PopUp "WAU Excluded Apps List opening..."
10851138
Start-Process "explorer.exe" -ArgumentList $excludedFile
10861139
} elseif (Test-Path $defaultExcludedFile) {
1087-
Start-PopUp "WAU Default Blacklist opening..."
1140+
Start-PopUp "WAU Default Excluded Apps List opening..."
10881141
Start-Process "explorer.exe" -ArgumentList $defaultExcludedFile
10891142
} else {
1090-
[System.Windows.MessageBox]::Show("No Blacklist found (neither 'excluded_apps.txt' nor 'config\default_excluded_apps.txt').", "File Not Found", "OK", "Warning")
1143+
[System.Windows.MessageBox]::Show("No Excluded Apps List found (neither 'excluded_apps.txt' nor 'config\default_excluded_apps.txt').", "File Not Found", "OK", "Warning")
1144+
return
10911145
}
10921146
}
10931147

@@ -1104,12 +1158,14 @@ function Show-WAUSettingsGUI {
11041158
})
11051159
}
11061160
catch {
1161+
Close-PopUp
11071162
[System.Windows.MessageBox]::Show("Failed to open List: $($_.Exception.Message)", "Error", "OK", "Error")
11081163
}
11091164
})
11101165

11111166
# Event handlers for controls
11121167
$controls.SaveButton.Add_Click({
1168+
Start-PopUp "Saving WAU settings..."
11131169
# Update status to "Saving settings"
11141170
$controls.StatusBarText.Text = "Saving settings..."
11151171
$controls.StatusBarText.Foreground = "Orange"
@@ -1122,6 +1178,7 @@ function Show-WAUSettingsGUI {
11221178
[datetime]::ParseExact($controls.UpdateTimeTextBox.Text, "HH:mm:ss", $null) | Out-Null
11231179
}
11241180
catch {
1181+
Close-PopUp
11251182
[System.Windows.MessageBox]::Show("Invalid time format. Please use HH:mm:ss format (e.g., 06:00:00)", "Error", "OK", "Error")
11261183
$controls.StatusBarText.Text = "$Script:STATUS_READY_TEXT"
11271184
$controls.StatusBarText.Foreground = "$Script:COLOR_INACTIVE"
@@ -1133,6 +1190,7 @@ function Show-WAUSettingsGUI {
11331190
[datetime]::ParseExact($controls.RandomDelayTextBox.Text, "HH:mm", $null) | Out-Null
11341191
}
11351192
catch {
1193+
Close-PopUp
11361194
[System.Windows.MessageBox]::Show("Invalid time format. Please use HH:mm format (e.g., 00:00)", "Error", "OK", "Error")
11371195
$controls.StatusBarText.Text = "$Script:STATUS_READY_TEXT"
11381196
$controls.StatusBarText.Foreground = "$Script:COLOR_INACTIVE"
@@ -1164,7 +1222,6 @@ function Show-WAUSettingsGUI {
11641222

11651223
# Save settings
11661224
if (Set-WAUConfig -Settings $newSettings) {
1167-
Start-PopUp "Saving WAU settings..."
11681225

11691226
# Update status to "Done"
11701227
$controls.StatusBarText.Text = "Done"

0 commit comments

Comments
 (0)