mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[FZE] Fix crash when double clicking edit layout (#12609)
This commit is contained in:
@@ -26,6 +26,7 @@ namespace FancyZonesEditor
|
|||||||
private LayoutModel _backup;
|
private LayoutModel _backup;
|
||||||
|
|
||||||
private ContentDialog _openedDialog;
|
private ContentDialog _openedDialog;
|
||||||
|
private bool _openingDialog = false; // Is the dialog being opened.
|
||||||
|
|
||||||
public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;
|
public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;
|
||||||
|
|
||||||
@@ -246,6 +247,12 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async void EditLayout_Click(object sender, RoutedEventArgs e)
|
private async void EditLayout_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// Avoid trying to open the same dialog twice.
|
||||||
|
if (!_openingDialog)
|
||||||
|
{
|
||||||
|
_openingDialog = true;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var dataContext = ((FrameworkElement)sender).DataContext;
|
var dataContext = ((FrameworkElement)sender).DataContext;
|
||||||
Select((LayoutModel)dataContext);
|
Select((LayoutModel)dataContext);
|
||||||
@@ -261,6 +268,13 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
await EditLayoutDialog.ShowAsync();
|
await EditLayoutDialog.ShowAsync();
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_openingDialog = false;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void EditZones_Click(object sender, RoutedEventArgs e)
|
private void EditZones_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -411,6 +425,7 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
private void Dialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
|
private void Dialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
|
||||||
{
|
{
|
||||||
|
_openingDialog = false;
|
||||||
_openedDialog = null;
|
_openedDialog = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user