mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
handle key events (#8279)
This commit is contained in:
parent
f86182d062
commit
c6078e3136
@ -91,6 +91,22 @@ namespace FancyZonesEditor
|
||||
Overlay.Show();
|
||||
}
|
||||
|
||||
public void App_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == System.Windows.Input.Key.LeftShift || e.Key == System.Windows.Input.Key.RightShift)
|
||||
{
|
||||
MainWindowSettings.IsShiftKeyPressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void App_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == System.Windows.Input.Key.LeftShift || e.Key == System.Windows.Input.Key.RightShift)
|
||||
{
|
||||
MainWindowSettings.IsShiftKeyPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowExceptionMessageBox(string message, Exception exception = null)
|
||||
{
|
||||
string fullMessage = FancyZonesEditor.Properties.Resources.Error_Report + PowerToysIssuesURL + " \n" + message;
|
||||
|
@ -19,6 +19,7 @@ namespace FancyZonesEditor
|
||||
InitializeComponent();
|
||||
|
||||
KeyUp += GridEditorWindow_KeyUp;
|
||||
KeyDown += ((App)Application.Current).App_KeyDown;
|
||||
|
||||
_stashedModel = (GridLayoutModel)(App.Overlay.CurrentDataContext as GridLayoutModel).Clone();
|
||||
}
|
||||
@ -36,6 +37,8 @@ namespace FancyZonesEditor
|
||||
{
|
||||
OnCancel(sender, null);
|
||||
}
|
||||
|
||||
((App)Application.Current).App_KeyUp(sender, e);
|
||||
}
|
||||
|
||||
private GridLayoutModel _stashedModel;
|
||||
|
@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using FancyZonesEditor.Utils;
|
||||
|
||||
@ -32,6 +33,9 @@ namespace FancyZonesEditor.Models
|
||||
Window.Background = (Brush)properties[milliseconds % properties.Length].GetValue(null, null);
|
||||
}
|
||||
|
||||
Window.KeyUp += ((App)Application.Current).App_KeyUp;
|
||||
Window.KeyDown += ((App)Application.Current).App_KeyDown;
|
||||
|
||||
Window.Left = workArea.X;
|
||||
Window.Top = workArea.Y;
|
||||
Window.Width = workArea.Width;
|
||||
|
Loading…
Reference in New Issue
Block a user