From bd09dfefb6836c50068aa294d1b1e0a02486b3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Takym=20=28=E3=81=9F=E3=81=8B=E3=82=84=E3=81=BE=29?= <15681312+Takym@users.noreply.github.com> Date: Sat, 29 Jun 2024 09:34:36 +0900 Subject: [PATCH] Simplify `NavigationRootManager.Connect` on the Windows platform. (#23345) * Simplify `NavigationRootManager.Connect` on the Windows platform. * Use ternary operator syntax * Removed extra tabs * Moved `_disconnected = false;` to `if (_disconnected)` --- .../Platform/Windows/NavigationRootManager.cs | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/Core/src/Platform/Windows/NavigationRootManager.cs b/src/Core/src/Platform/Windows/NavigationRootManager.cs index 7817562f35c7..fa0535e73a9f 100644 --- a/src/Core/src/Platform/Windows/NavigationRootManager.cs +++ b/src/Core/src/Platform/Windows/NavigationRootManager.cs @@ -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; }