Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Files.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

using Microsoft.Extensions.Logging;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml.Controls;
Expand Down Expand Up @@ -247,11 +248,26 @@ async Task PerformNavigationAsync(string payload, string selectItem = null)
}

var generalSettingsService = Ioc.Default.GetService<IGeneralSettingsService>();

double boundsWidth = 0;
try
{
boundsWidth = Bounds.Width;
}
catch (Exception ex)
{
// Handle exception in case WinUI Windows is closed
// (see https://github.com/files-community/Files/issues/15599)

App.Logger.LogWarning(ex, ex.Message);
return;
}

var paneNavigationArgs = new PaneNavigationArguments
{
LeftPaneNavPathParam = payload,
LeftPaneSelectItemParam = selectItem,
RightPaneNavPathParam = Bounds.Width > Constants.UI.MultiplePaneWidthThreshold && (generalSettingsService?.AlwaysOpenDualPaneInNewTab ?? false) ? "Home" : null,
RightPaneNavPathParam = boundsWidth > Constants.UI.MultiplePaneWidthThreshold && (generalSettingsService?.AlwaysOpenDualPaneInNewTab ?? false) ? "Home" : null,
};

if (rootFrame.Content is MainPage && MainPageViewModel.AppInstances.Any())
Expand Down