This commit is contained in:
Clint Rutkas
2019-12-12 17:11:47 -08:00
parent 107595fcb2
commit 0ff2e212d5
2 changed files with 15 additions and 4 deletions

View File

@@ -14,8 +14,8 @@
Background="White"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Initialized="InitializedEventHandler"
Closed="OnClosed">
Initialized="OnInitialized"
Closing="OnClosing">
<Window.Resources>
<Converters:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
<Converters:ModelToVisibilityConverter x:Key="ModelToVisibilityConverter" />

View File

@@ -29,6 +29,9 @@ namespace FancyZonesEditor
{
InitializeComponent();
DataContext = _settings;
KeyUp += MainWindow_KeyUp;
if (_settings.WorkArea.Height < 900)
{
SizeToContent = SizeToContent.WidthAndHeight;
@@ -36,6 +39,14 @@ namespace FancyZonesEditor
}
}
private void MainWindow_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
OnClosing(sender, null);
}
}
private void DecrementZones_Click(object sender, RoutedEventArgs e)
{
if (_settings.ZoneCount > 1)
@@ -152,7 +163,7 @@ namespace FancyZonesEditor
}
}
private void OnClosed(object sender, EventArgs e)
private void OnClosing(object sender, EventArgs e)
{
if (!_editing)
{
@@ -160,7 +171,7 @@ namespace FancyZonesEditor
}
}
private void InitializedEventHandler(object sender, EventArgs e)
private void OnInitialized(object sender, EventArgs e)
{
SetSelectedItem();
}