Consolidate config actions into menu

This commit is contained in:
Ray Berezowski
2026-06-02 22:00:35 -04:00
parent 84e89ec11c
commit 1511aae219
3 changed files with 63 additions and 6 deletions

View File

@@ -721,6 +721,17 @@ public partial class MainWindow : Window
}
}
private void ConfigMenuButton_Click(object sender, RoutedEventArgs e)
{
if (ConfigMenuButton.ContextMenu is null)
{
return;
}
ConfigMenuButton.ContextMenu.PlacementTarget = ConfigMenuButton;
ConfigMenuButton.ContextMenu.IsOpen = true;
}
private void ExportConfig_Click(object sender, RoutedEventArgs e)
{
if (controller is null)
@@ -792,6 +803,33 @@ public partial class MainWindow : Window
}
}
private void ResetConfig_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show(
"Reset launcher config to the default folders and apps?\n\nA local backup will be created first.",
"Taskbar Launcher",
MessageBoxButton.YesNo,
MessageBoxImage.Warning);
if (result != MessageBoxResult.Yes)
{
return;
}
try
{
string backupPath = ConfigService.Backup();
ConfigService.ResetToDefaults();
controller?.ReloadConfig();
RefreshView();
StatusText.Text = $"Reset config to defaults. Previous config backed up to {backupPath}";
}
catch (Exception ex)
{
MessageBox.Show($"Could not reset config.\n\n{ex.Message}", "Taskbar Launcher");
}
}
private List<int>? FindItemPath(LauncherItem item)
{
if (controller is null)