Skip to content

Commit 32c27a5

Browse files
committed
DevListButton for opening the active List
1 parent d652db4 commit 32c27a5

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

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

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,10 @@ function Show-WAUSettingsGUI {
697697
<Hyperlink x:Name="IssuesLink" NavigateUri="https://github.com/microsoft/winget-pkgs/issues" ToolTip="open 'winget-pkgs' Issues on GitHub">[issues]</Hyperlink>
698698
</TextBlock>
699699
</StackPanel>
700-
<Button x:Name="DevTaskButton" Content="[task]" Width="50" Height="25" Visibility="Collapsed" Margin="0,0,5,0"/>
701-
<Button x:Name="DevRegButton" Content="[reg]" Width="50" Height="25" Visibility="Collapsed" Margin="0,0,5,0"/>
702-
<Button x:Name="DevGUIDButton" Content="[guid]" Width="50" Height="25" Visibility="Collapsed" Margin="0,0,0,0"/>
700+
<Button x:Name="DevTaskButton" Content="[task]" Width="40" Height="25" Visibility="Collapsed" Margin="0,0,5,0"/>
701+
<Button x:Name="DevRegButton" Content="[reg]" Width="40" Height="25" Visibility="Collapsed" Margin="0,0,5,0"/>
702+
<Button x:Name="DevGUIDButton" Content="[guid]" Width="40" Height="25" Visibility="Collapsed" Margin="0,0,5,0"/>
703+
<Button x:Name="DevListButton" Content="[list]" Width="40" Height="25" Visibility="Collapsed" Margin="0,0,0,0"/>
703704
</StackPanel>
704705
</Grid>
705706
</GroupBox>
@@ -1064,6 +1065,49 @@ function Show-WAUSettingsGUI {
10641065
}
10651066
})
10661067

1068+
$controls.DevListButton.Add_Click({
1069+
try {
1070+
$updatedConfig = Get-WAUCurrentConfig
1071+
$installDir = $updatedConfig.InstallLocation
1072+
if ($updatedConfig.WAU_UseWhiteList -eq 1) {
1073+
$whiteListFile = Join-Path $installDir 'included_apps.txt'
1074+
if (Test-Path $whiteListFile) {
1075+
Start-PopUp "WAU Whitelist opening..."
1076+
Start-Process "explorer.exe" -ArgumentList $whiteListFile
1077+
} else {
1078+
[System.Windows.MessageBox]::Show("'included_apps.txt' not found in $installDir", "File Not Found", "OK", "Warning")
1079+
}
1080+
} else {
1081+
$excludedFile = Join-Path $installDir 'excluded_apps.txt'
1082+
$defaultExcludedFile = Join-Path $installDir 'config\default_excluded_apps.txt'
1083+
if (Test-Path $excludedFile) {
1084+
Start-PopUp "WAU Blacklist opening..."
1085+
Start-Process "explorer.exe" -ArgumentList $excludedFile
1086+
} elseif (Test-Path $defaultExcludedFile) {
1087+
Start-PopUp "WAU Default Blacklist opening..."
1088+
Start-Process "explorer.exe" -ArgumentList $defaultExcludedFile
1089+
} else {
1090+
[System.Windows.MessageBox]::Show("No Blacklist found (neither 'excluded_apps.txt' nor 'config\default_excluded_apps.txt').", "File Not Found", "OK", "Warning")
1091+
}
1092+
}
1093+
1094+
# Update status to "Done"
1095+
$controls.StatusBarText.Text = "Done"
1096+
$controls.StatusBarText.Foreground = $Script:COLOR_ENABLED
1097+
1098+
# Create timer to reset status back to ready after 1 second
1099+
$window.Dispatcher.BeginInvoke([System.Windows.Threading.DispatcherPriority]::Background, [Action]{
1100+
Start-Sleep -Milliseconds 1000
1101+
$controls.StatusBarText.Text = "$Script:STATUS_READY_TEXT"
1102+
$controls.StatusBarText.Foreground = "$Script:COLOR_INACTIVE"
1103+
Close-PopUp
1104+
})
1105+
}
1106+
catch {
1107+
[System.Windows.MessageBox]::Show("Failed to open List: $($_.Exception.Message)", "Error", "OK", "Error")
1108+
}
1109+
})
1110+
10671111
# Event handlers for controls
10681112
$controls.SaveButton.Add_Click({
10691113
# Update status to "Saving settings"
@@ -1193,12 +1237,14 @@ function Show-WAUSettingsGUI {
11931237
$controls.DevTaskButton.Visibility = 'Visible'
11941238
$controls.DevRegButton.Visibility = 'Visible'
11951239
$controls.DevGUIDButton.Visibility = 'Visible'
1240+
$controls.DevListButton.Visibility = 'Visible'
11961241
$controls.LinksStackPanel.Visibility = 'Visible'
11971242
$window.Title = "$Script:WAU_TITLE - Dev Tools"
11981243
} else {
11991244
$controls.DevTaskButton.Visibility = 'Collapsed'
12001245
$controls.DevRegButton.Visibility = 'Collapsed'
12011246
$controls.DevGUIDButton.Visibility = 'Collapsed'
1247+
$controls.DevListButton.Visibility = 'Collapsed'
12021248
$controls.LinksStackPanel.Visibility = 'Collapsed'
12031249
$window.Title = "$Script:WAU_TITLE"
12041250
}

0 commit comments

Comments
 (0)