Consolidate config actions into menu
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user