From efdd8d5ac70968cc2014426091ae1f5134b6df79 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Tue, 14 Mar 2023 15:55:05 +0900 Subject: [PATCH 1/2] Add the condition for double-clicking to go up --- src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs | 6 +++--- .../Views/LayoutModes/DetailsLayoutBrowser.xaml.cs | 6 +++--- src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs index 4a7edc33c12e..ba81951842fb 100644 --- a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs +++ b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs @@ -350,14 +350,14 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) ItemInvoked?.Invoke(new ColumnParam { NavPathParam = (item is ShortcutItem sht ? sht.TargetPath : item.ItemPath), ListView = FileList }, EventArgs.Empty); break; default: - if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) + if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) ParentShellPageInstance.Up_Click(); break; } } - else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) { - ParentShellPageInstance.Up_Click(); + ParentShellPageInstance.Up_Click(); } ResetRenameDoubleClick(); diff --git a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 7ea62c476d7d..82a0732e77f5 100644 --- a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -484,10 +484,10 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { _ = NavigationHelpers.OpenPath(item.ItemPath, ParentShellPageInstance); } - else + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp + && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) { - if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) - ParentShellPageInstance.Up_Click(); + ParentShellPageInstance.Up_Click(); } ResetRenameDoubleClick(); } diff --git a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs index 8e7ab179a150..d560da79e0d7 100644 --- a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs @@ -409,10 +409,10 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { _ = NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false); } - else + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp + && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) { - if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) - ParentShellPageInstance.Up_Click(); + ParentShellPageInstance.Up_Click(); } ResetRenameDoubleClick(); } From f23caf3cc89127c7fd4524be78f5191b0a2432d6 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Tue, 14 Mar 2023 17:37:34 +0900 Subject: [PATCH 2/2] Refactored --- src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs | 4 ++-- src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs | 3 +-- src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs | 3 +-- src/Files.App/Views/ModernShellPage.xaml.cs | 3 +++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs index ba81951842fb..32c74c76e3c9 100644 --- a/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs +++ b/src/Files.App/Views/LayoutModes/ColumnViewBase.xaml.cs @@ -350,12 +350,12 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) ItemInvoked?.Invoke(new ColumnParam { NavPathParam = (item is ShortcutItem sht ? sht.TargetPath : item.ItemPath), ListView = FileList }, EventArgs.Empty); break; default: - if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) + if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) ParentShellPageInstance.Up_Click(); break; } } - else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) { ParentShellPageInstance.Up_Click(); } diff --git a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 82a0732e77f5..38847091ab2a 100644 --- a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -484,8 +484,7 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { _ = NavigationHelpers.OpenPath(item.ItemPath, ParentShellPageInstance); } - else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp - && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) { ParentShellPageInstance.Up_Click(); } diff --git a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs index d560da79e0d7..cff8691165d2 100644 --- a/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs @@ -409,8 +409,7 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { _ = NavigationHelpers.OpenSelectedItems(ParentShellPageInstance, false); } - else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp - && ParentShellPageInstance.ToolbarViewModel.CanNavigateToParent) + else if (UserSettingsService.FoldersSettingsService.DoubleClickToGoUp) { ParentShellPageInstance.Up_Click(); } diff --git a/src/Files.App/Views/ModernShellPage.xaml.cs b/src/Files.App/Views/ModernShellPage.xaml.cs index 15bac9db2498..0fa0dd980e28 100644 --- a/src/Files.App/Views/ModernShellPage.xaml.cs +++ b/src/Files.App/Views/ModernShellPage.xaml.cs @@ -325,6 +325,9 @@ public override void Forward_Click() public override void Up_Click() { + if (!ToolbarViewModel.CanNavigateToParent) + return; + ToolbarViewModel.CanNavigateToParent = false; if (string.IsNullOrEmpty(FilesystemViewModel?.WorkingDirectory)) return;