From 09dd7ed18fd7f25b53f49f205374e14885223d5e Mon Sep 17 00:00:00 2001 From: Rekkonnect Date: Sat, 11 May 2024 18:44:00 +0300 Subject: [PATCH] Add main view shortcuts --- Syndiesis/Views/MainView.axaml.cs | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Syndiesis/Views/MainView.axaml.cs b/Syndiesis/Views/MainView.axaml.cs index abcaa22..17e21cd 100644 --- a/Syndiesis/Views/MainView.axaml.cs +++ b/Syndiesis/Views/MainView.axaml.cs @@ -77,6 +77,11 @@ private void CollapseAllClick(object? sender, RoutedEventArgs e) } private void HandleSettingsClick(object? sender, RoutedEventArgs e) + { + RequestSettings(); + } + + private void RequestSettings() { SettingsRequested?.Invoke(); } @@ -190,4 +195,32 @@ protected override void OnGotFocus(GotFocusEventArgs e) base.OnGotFocus(e); codeEditor.Focus(); } + + protected override void OnKeyDown(KeyEventArgs e) + { + var modifiers = e.KeyModifiers; + + bool hasControl = modifiers.HasFlag(KeyModifiers.Control); + + switch (e.Key) + { + case Key.S: + if (hasControl) + { + RequestSettings(); + e.Handled = true; + } + break; + + case Key.R: + if (hasControl) + { + Reset(); + e.Handled = true; + } + break; + } + + base.OnKeyDown(e); + } }