Skip to content

Commit

Permalink
removed OwnerClosing handler
Browse files Browse the repository at this point in the history
  • Loading branch information
i28423 authored and i28423 committed Sep 27, 2023
1 parent 4d70c81 commit 6236553
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/DialogServiceViews.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ internal static void Register(IView view)
// only register for the event once, thus the un-registration of any prior
// registrations.
owner.Closed -= OwnerClosed;
owner.Closing -= OwnerClosing;
owner.Closing += OwnerClosing;
owner.Closed += OwnerClosed;

Logger.Write($"Register view {view.Id}");
Expand Down Expand Up @@ -184,25 +182,6 @@ private static void LateRegister(object sender, RoutedEventArgs e)
}
}

private static void OwnerClosing(object? sender, CancelEventArgs e)
{
if (sender is Window owner)
{
var ownerThread = owner.Dispatcher.Thread.ManagedThreadId;
// Find views acting within closed window
IView[] windowViews = Views
.Where(view => ReferenceEquals(view.GetOwner(), owner))
.ToArray();

// Unregister Views in window
foreach (IView windowView in windowViews)
{
Logger.Write($"Window containing view {windowView.Id} closed");
Unregister(windowView);
}
}
}

/// <summary>
/// Handles owner window closed. All views acting within the closed window should be
/// unregistered.
Expand Down

0 comments on commit 6236553

Please sign in to comment.