mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FancyZones Editor] Crash when changing between zone layouts: refactoring (#12815)
This commit is contained in:
@@ -30,7 +30,6 @@ namespace FancyZonesEditor
|
||||
|
||||
private ContentDialog _openedDialog;
|
||||
private TextBlock _createLayoutAnnounce;
|
||||
private bool _openingDialog = false; // Is the dialog being opened.
|
||||
|
||||
public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;
|
||||
|
||||
@@ -281,11 +280,11 @@ namespace FancyZonesEditor
|
||||
private async void EditLayout_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Avoid trying to open the same dialog twice.
|
||||
if (!_openingDialog)
|
||||
{
|
||||
_openingDialog = true;
|
||||
try
|
||||
if (_openedDialog != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var dataContext = ((FrameworkElement)sender).DataContext;
|
||||
Select((LayoutModel)dataContext);
|
||||
|
||||
@@ -300,13 +299,6 @@ namespace FancyZonesEditor
|
||||
|
||||
await EditLayoutDialog.ShowAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
_openingDialog = false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EditZones_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -454,7 +446,6 @@ namespace FancyZonesEditor
|
||||
|
||||
private void Dialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args)
|
||||
{
|
||||
_openingDialog = false;
|
||||
_openedDialog = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user