Skip to content

Commit

Permalink
Remove IF
Browse files Browse the repository at this point in the history
  • Loading branch information
heldergoncalves92 committed Nov 20, 2024
1 parent f919f77 commit 624f250
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions WebViewControl.Avalonia/BaseControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ public abstract class BaseControl : Control {
protected abstract void InternalDispose();

protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) {
if (e.Root is Window window) {
if (attachedWindow != window) {
attachedWindow?.RemoveHandler(Window.WindowClosedEvent, (EventHandler<RoutedEventArgs>)OnHostWindowClosed);

attachedWindow = window;
attachedWindow.AddHandler(Window.WindowClosedEvent, (EventHandler<RoutedEventArgs>)OnHostWindowClosed);
}
if (e.Root is Window window && attachedWindow != window) {
attachedWindow?.RemoveHandler(Window.WindowClosedEvent, (EventHandler<RoutedEventArgs>)OnHostWindowClosed);

attachedWindow = window;
attachedWindow.AddHandler(Window.WindowClosedEvent, (EventHandler<RoutedEventArgs>)OnHostWindowClosed);
}
base.OnAttachedToLogicalTree(e);
}
Expand Down

0 comments on commit 624f250

Please sign in to comment.