Skip to content

Commit

Permalink
Simplify NavigationRootManager.Connect on the Windows platform. (#2…
Browse files Browse the repository at this point in the history
…3345)

* Simplify `NavigationRootManager.Connect` on the Windows platform.

* Use ternary operator syntax

* Removed extra tabs

* Moved `_disconnected = false;` to `if (_disconnected)`
  • Loading branch information
Takym committed Jun 29, 2024
1 parent f54f8a5 commit bd09dfe
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/Core/src/Platform/Windows/NavigationRootManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,17 @@ public virtual void Connect(UIElement platformView)
_rootView.Content = null;
}

NavigationView rootNavigationView;
if (platformView is NavigationView nv)
_rootView.Content = platformView is NavigationView ? platformView : new RootNavigationView()
{
rootNavigationView = nv;
_rootView.Content = platformView;
}
else
{
if (_rootView.Content is RootNavigationView navView)
{
rootNavigationView = navView;
}
else
{
rootNavigationView = new RootNavigationView();
}

rootNavigationView.Content = platformView;
_rootView.Content = rootNavigationView;
}
Content = platformView
};

if (_disconnected)
{
_platformWindow.Activated += OnWindowActivated;
_disconnected = false;
}

_disconnected = false;
_rootView.OnWindowTitleBarContentSizeChanged += WindowRootViewOnWindowTitleBarContentSizeChanged;
}

Expand Down

0 comments on commit bd09dfe

Please sign in to comment.