Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@
PrimaryButtonText="{x:Static props:Resources.Save}"
PrimaryButtonClick="EditLayoutDialog_PrimaryButtonClick"
SecondaryButtonClick="EditLayoutDialog_SecondaryButtonClick"
Title="{x:Static props:Resources.Edit_Layout}">
Title="{x:Static props:Resources.Edit_Layout}"
Opened="Dialog_Opened"
Closed="Dialog_Closed">
<StackPanel Margin="0,16,0,0"
MinWidth="420"
DataContext="{Binding SelectedModel}">
Expand Down Expand Up @@ -551,7 +553,9 @@
PrimaryButtonText="{x:Static props:Resources.Create}"
PrimaryButtonClick="NewLayoutDialog_PrimaryButtonClick"
IsPrimaryButtonEnabled="{Binding ElementName=LayoutNameText, Path=Text.Length}"
Title="{x:Static props:Resources.Choose_layout_type}">
Title="{x:Static props:Resources.Choose_layout_type}"
Opened="Dialog_Opened"
Closed="Dialog_Closed">
<StackPanel Margin="0,16,0,0">
<TextBlock x:Name="NameHeaderText"
Text="{x:Static props:Resources.Name}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public partial class MainWindow : Window
private readonly MainWindowSettingsModel _settings = ((App)Application.Current).MainWindowSettings;
private LayoutModel _backup = null;

private ContentDialog _openedDialog = null;

public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;

public MainWindow(bool spanZonesAcrossMonitors, Rect workArea)
Expand Down Expand Up @@ -56,7 +58,14 @@ private void MainWindow_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
OnClosing(sender, null);
if (_openedDialog != null)
{
_openedDialog.Hide();
}
else
{
OnClosing(sender, null);
}
}
}

Expand Down Expand Up @@ -375,5 +384,15 @@ private async void DeleteLayout(FrameworkElement element)
model.Delete();
}
}

private void Dialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
_openedDialog = sender;
}

private void Dialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
_openedDialog = null;
}
}
}