DebugProvider.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.IO;
  2. using System.Windows.Input;
  3. namespace PixiEditor.Models.Commands.Templates;
  4. public partial class ShortcutProvider
  5. {
  6. private static DebugProvider Debug { get; } = new();
  7. public class DebugProvider : ShortcutProvider, IShortcutDefaults, IShortcutFile, IShortcutInstallation
  8. {
  9. private static string InstallationPath { get; } = Path.Combine(
  10. Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
  11. "shortcut-provider.json");
  12. public override string Description => "A provider for testing providers";
  13. public DebugProvider() : base("Debug")
  14. {
  15. }
  16. public ShortcutCollection DefaultShortcuts { get; } = new()
  17. {
  18. // Add shortcuts for undo and redo
  19. { "PixiEditor.Undo.Undo", Key.Z, ModifierKeys.Control },
  20. { "PixiEditor.Undo.Redo", Key.Y, ModifierKeys.Control },
  21. "PixiEditor.Colors.Swap"
  22. };
  23. public string Filter => "json (*.json)|*.json";
  24. public ShortcutCollection GetShortcuts(string path) => new(ShortcutFile.LoadShortcuts(path));
  25. public bool InstallationPresent => File.Exists(InstallationPath);
  26. public ShortcutCollection GetInstalledShortcuts() => new(ShortcutFile.LoadShortcuts(InstallationPath));
  27. }
  28. }