Skip to content

Commit

Permalink
Added keyboard shortcut for adding custom colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ptr-cs committed Sep 5, 2022
1 parent 00b8a31 commit ea497e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ColorSelector/ColorSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,12 @@ public override void OnApplyTemplate()
this.CommandBindings.Remove(new CommandBinding(ApplicationCommands.Paste, new ExecutedRoutedEventHandler(PasteHandler)));
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, new ExecutedRoutedEventHandler(PasteHandler)));
this.InputBindings.Add(new KeyBinding(ToggleMenuCommand, new KeyGesture(Key.M, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(SaveCustomColorCommand, new KeyGesture(Key.E, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(ExportCustomColorsCommand, new KeyGesture(Key.E, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(ImportCustomColorsCommand, new KeyGesture(Key.I, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(IncreaseAppScaleCommand, new KeyGesture(Key.OemPlus, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(DecreaseAppScaleCommand, new KeyGesture(Key.OemMinus, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(ResetAppScaleCommand, new KeyGesture(Key.R, ModifierKeys.Control)));
this.InputBindings.Add(new KeyBinding(SaveCustomColorCommand, new KeyGesture(Key.A, ModifierKeys.Control)));
}

// Rates of change and limits for different color components:
Expand Down Expand Up @@ -2378,6 +2379,7 @@ private void OnExportToFile()
using (System.Windows.Forms.SaveFileDialog saveFileDialog = new()
{
Filter = "JSON files (*.json)|*.json",
Title = "Export colors",
InitialDirectory = initialDirectory,
RestoreDirectory = true,
FileName = fileName
Expand Down Expand Up @@ -2411,6 +2413,7 @@ private void ImportFromFile(ImportType importType, string filePath = "")
using (System.Windows.Forms.OpenFileDialog openFileDialog = new()
{
Filter = "JSON files (*.json)|*.json",
Title = "Import colors",
InitialDirectory = initialDirectory,
RestoreDirectory = true,
CheckFileExists = true
Expand Down

0 comments on commit ea497e4

Please sign in to comment.