mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
handle key events (#8279)
This commit is contained in:
@@ -91,6 +91,22 @@ namespace FancyZonesEditor
|
|||||||
Overlay.Show();
|
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)
|
public static void ShowExceptionMessageBox(string message, Exception exception = null)
|
||||||
{
|
{
|
||||||
string fullMessage = FancyZonesEditor.Properties.Resources.Error_Report + PowerToysIssuesURL + " \n" + message;
|
string fullMessage = FancyZonesEditor.Properties.Resources.Error_Report + PowerToysIssuesURL + " \n" + message;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace FancyZonesEditor
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
KeyUp += GridEditorWindow_KeyUp;
|
KeyUp += GridEditorWindow_KeyUp;
|
||||||
|
KeyDown += ((App)Application.Current).App_KeyDown;
|
||||||
|
|
||||||
_stashedModel = (GridLayoutModel)(App.Overlay.CurrentDataContext as GridLayoutModel).Clone();
|
_stashedModel = (GridLayoutModel)(App.Overlay.CurrentDataContext as GridLayoutModel).Clone();
|
||||||
}
|
}
|
||||||
@@ -36,6 +37,8 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
OnCancel(sender, null);
|
OnCancel(sender, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((App)Application.Current).App_KeyUp(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GridLayoutModel _stashedModel;
|
private GridLayoutModel _stashedModel;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using FancyZonesEditor.Utils;
|
using FancyZonesEditor.Utils;
|
||||||
|
|
||||||
@@ -32,6 +33,9 @@ namespace FancyZonesEditor.Models
|
|||||||
Window.Background = (Brush)properties[milliseconds % properties.Length].GetValue(null, null);
|
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.Left = workArea.X;
|
||||||
Window.Top = workArea.Y;
|
Window.Top = workArea.Y;
|
||||||
Window.Width = workArea.Width;
|
Window.Width = workArea.Width;
|
||||||
|
|||||||
Reference in New Issue
Block a user