diff --git a/LANCommander.Launcher/Services/NavigationService.cs b/LANCommander.Launcher/Services/NavigationService.cs index 84428ca0..f7e587ca 100644 --- a/LANCommander.Launcher/Services/NavigationService.cs +++ b/LANCommander.Launcher/Services/NavigationService.cs @@ -49,17 +49,17 @@ public partial class NavigationService : ObservableObject, INavigationService } // Show the loading overlay and yield so the UI thread can paint it - // BEFORE the heavy view creation from the ContentControl DataTemplate. + // over the CURRENT view before we do any heavy work. IsNavigating = true; await Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Render).GetTask(); - CurrentView = viewModel; - try { if (initializeAsync != null) await initializeAsync(); + CurrentView = viewModel; + // Yield again so the new view finishes layout/render // before we hide the overlay. await Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Background).GetTask(); @@ -67,6 +67,8 @@ public partial class NavigationService : ObservableObject, INavigationService catch { // Initialization errors are handled by the caller's callback. + // Still swap to the target view so navigation isn't left stuck. + CurrentView = viewModel; } finally {