mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Enable closing Edit Canvas Layout and Edit Grid Layout windows by pressing Esc button (#7643)
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using FancyZonesEditor.Models;
|
using FancyZonesEditor.Models;
|
||||||
|
|
||||||
namespace FancyZonesEditor
|
namespace FancyZonesEditor
|
||||||
@@ -15,6 +16,9 @@ namespace FancyZonesEditor
|
|||||||
public CanvasEditorWindow()
|
public CanvasEditorWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
KeyUp += CanvasEditorWindow_KeyUp;
|
||||||
|
|
||||||
_model = EditorOverlay.Current.DataContext as CanvasLayoutModel;
|
_model = EditorOverlay.Current.DataContext as CanvasLayoutModel;
|
||||||
_stashedModel = (CanvasLayoutModel)_model.Clone();
|
_stashedModel = (CanvasLayoutModel)_model.Clone();
|
||||||
}
|
}
|
||||||
@@ -41,6 +45,14 @@ namespace FancyZonesEditor
|
|||||||
_stashedModel.RestoreTo(_model);
|
_stashedModel.RestoreTo(_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CanvasEditorWindow_KeyUp(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
OnCancel(sender, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int _offset = 100;
|
private int _offset = 100;
|
||||||
private CanvasLayoutModel _model;
|
private CanvasLayoutModel _model;
|
||||||
private CanvasLayoutModel _stashedModel;
|
private CanvasLayoutModel _stashedModel;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using FancyZonesEditor.Models;
|
using FancyZonesEditor.Models;
|
||||||
|
|
||||||
namespace FancyZonesEditor
|
namespace FancyZonesEditor
|
||||||
@@ -15,6 +16,9 @@ namespace FancyZonesEditor
|
|||||||
public GridEditorWindow()
|
public GridEditorWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
KeyUp += GridEditorWindow_KeyUp;
|
||||||
|
|
||||||
_stashedModel = (GridLayoutModel)(EditorOverlay.Current.DataContext as GridLayoutModel).Clone();
|
_stashedModel = (GridLayoutModel)(EditorOverlay.Current.DataContext as GridLayoutModel).Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +29,14 @@ namespace FancyZonesEditor
|
|||||||
_stashedModel.RestoreTo(model);
|
_stashedModel.RestoreTo(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GridEditorWindow_KeyUp(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
OnCancel(sender, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private GridLayoutModel _stashedModel;
|
private GridLayoutModel _stashedModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user