mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 21:54:59 +00:00
feat: Reset Mode Hotkey (#714)
This commit is contained in:
parent
f4618afee6
commit
ea1d966d27
3 changed files with 41 additions and 9 deletions
|
@ -1,4 +1,8 @@
|
|||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using SourceGit.Models;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -8,5 +12,28 @@ namespace SourceGit.Views
|
|||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InputElement_OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var key = e.Key.ToString().ToLower();
|
||||
foreach (var item in ResetMode.ItemsSource)
|
||||
{
|
||||
if (item.GetType() == typeof(ResetMode))
|
||||
{
|
||||
var resetMode = (ResetMode)item;
|
||||
if (resetMode.Key.ToString().ToLower() == key)
|
||||
{
|
||||
ResetMode.SelectedValue = resetMode;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Control_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ResetMode.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue