From af953bec0c0f60b37fa4b650aee98a24fb5498f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= <55754091+hecksmosis@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:55:52 +0100 Subject: [PATCH 1/5] Codebase: Remove unnecessary using directives (#11300) Remove unnecessary using directives --- src/Files.App/App.xaml.cs | 1 - src/Files.App/DataModels/SidebarPinnedModel.cs | 2 -- src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs | 1 - .../FilesystemOperations/FilesystemOperations.cs | 2 -- src/Files.App/Filesystem/RecentItem.cs | 1 - src/Files.App/Helpers/CommonPaths.cs | 1 - src/Files.App/Helpers/ContextFlyoutItemHelper.cs | 1 - src/Files.App/Helpers/MultitaskingTabsHelpers.cs | 1 - src/Files.App/Helpers/ShellContextMenuHelper.cs | 1 - .../Settings/LayoutSettingsService.cs | 1 - .../UserControls/InnerNavigationToolbar.xaml.cs | 1 - .../UserControls/Widgets/DrivesWidget.xaml.cs | 7 ------- .../UserControls/Widgets/FileTagsWidget.xaml.cs | 4 +--- src/Files.App/UserControls/Widgets/HomePageWidget.cs | 11 ----------- .../UserControls/Widgets/RecentFilesWidget.xaml.cs | 6 ------ src/Files.App/UserControls/Widgets/WidgetCardItem.cs | 6 ------ .../ViewModels/SettingsViewModels/FoldersViewModel.cs | 1 - src/Files.App/ViewModels/StatusCenterViewModel.cs | 3 --- src/Files.App/Views/WidgetsPage.xaml.cs | 1 - src/Files.Backend/Services/IQuickAccessService.cs | 3 +-- .../Services/Settings/IFoldersSettingsService.cs | 3 +-- .../Services/Settings/ILayoutSettingsService.cs | 3 +-- .../FileTagsWidget/FileTagsContainerViewModel.cs | 1 - 23 files changed, 4 insertions(+), 58 deletions(-) diff --git a/src/Files.App/App.xaml.cs b/src/Files.App/App.xaml.cs index 653422bc2ff4..014969cb44ad 100644 --- a/src/Files.App/App.xaml.cs +++ b/src/Files.App/App.xaml.cs @@ -2,7 +2,6 @@ using CommunityToolkit.WinUI; using CommunityToolkit.WinUI.Helpers; using CommunityToolkit.WinUI.Notifications; -using Files.App.Controllers; using Files.App.DataModels; using Files.App.Extensions; using Files.App.Filesystem; diff --git a/src/Files.App/DataModels/SidebarPinnedModel.cs b/src/Files.App/DataModels/SidebarPinnedModel.cs index f62552b8db6e..27626eccfdbd 100644 --- a/src/Files.App/DataModels/SidebarPinnedModel.cs +++ b/src/Files.App/DataModels/SidebarPinnedModel.cs @@ -1,6 +1,5 @@ using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.WinUI; -using Files.App.Controllers; using Files.App.DataModels.NavigationControlItems; using Files.App.Filesystem; using Files.App.Helpers; @@ -12,7 +11,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection; using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; diff --git a/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs b/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs index 3506d1e3847e..bf97e2820f53 100644 --- a/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs +++ b/src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs @@ -3,7 +3,6 @@ using Files.Shared.Enums; using Microsoft.UI.Xaml.Controls; using System; -using System.IO; using System.Threading.Tasks; namespace Files.App.Dialogs diff --git a/src/Files.App/Filesystem/FilesystemOperations/FilesystemOperations.cs b/src/Files.App/Filesystem/FilesystemOperations/FilesystemOperations.cs index 4e8b0293f30d..ac955f7bfd85 100644 --- a/src/Files.App/Filesystem/FilesystemOperations/FilesystemOperations.cs +++ b/src/Files.App/Filesystem/FilesystemOperations/FilesystemOperations.cs @@ -1,10 +1,8 @@ -using CommunityToolkit.Mvvm.DependencyInjection; using Files.App.Extensions; using Files.App.Filesystem.FilesystemHistory; using Files.App.Filesystem.StorageItems; using Files.App.Helpers; using Files.Backend.Helpers; -using Files.Backend.Services; using Files.Shared; using Files.Shared.Enums; using Files.Shared.Extensions; diff --git a/src/Files.App/Filesystem/RecentItem.cs b/src/Files.App/Filesystem/RecentItem.cs index 0ff7737e6b51..26164944600c 100644 --- a/src/Files.App/Filesystem/RecentItem.cs +++ b/src/Files.App/Filesystem/RecentItem.cs @@ -1,4 +1,3 @@ -using CommunityToolkit.Mvvm.ComponentModel; using Files.App.Filesystem.StorageItems; using Files.App.Helpers; using Files.App.UserControls.Widgets; diff --git a/src/Files.App/Helpers/CommonPaths.cs b/src/Files.App/Helpers/CommonPaths.cs index 7937ea055dd5..93b9fb197850 100644 --- a/src/Files.App/Helpers/CommonPaths.cs +++ b/src/Files.App/Helpers/CommonPaths.cs @@ -1,4 +1,3 @@ -using Files.App.Extensions; using Files.Shared.Extensions; using System; using System.Collections.Generic; diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index 0ce0b3284dc2..7b02bb4e8112 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -7,7 +7,6 @@ using Files.Backend.Services; using Files.Backend.Helpers; using Files.Backend.Services.Settings; -using Files.Shared; using Files.Shared.Enums; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media.Imaging; diff --git a/src/Files.App/Helpers/MultitaskingTabsHelpers.cs b/src/Files.App/Helpers/MultitaskingTabsHelpers.cs index 43390eca4a56..f907170ea542 100644 --- a/src/Files.App/Helpers/MultitaskingTabsHelpers.cs +++ b/src/Files.App/Helpers/MultitaskingTabsHelpers.cs @@ -1,4 +1,3 @@ -using Files.App.Extensions; using Files.App.UserControls.MultitaskingControl; using Files.App.ViewModels; using Microsoft.UI.Xaml.Controls; diff --git a/src/Files.App/Helpers/ShellContextMenuHelper.cs b/src/Files.App/Helpers/ShellContextMenuHelper.cs index a72d3da2e43a..9770c9378f78 100644 --- a/src/Files.App/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.App/Helpers/ShellContextMenuHelper.cs @@ -4,7 +4,6 @@ using Files.App.Extensions; using Files.App.Filesystem; using Files.App.Helpers.ContextFlyouts; -using Files.App.ServicesImplementation.Settings; using Files.App.Shell; using Files.App.ViewModels; using Files.Backend.Helpers; diff --git a/src/Files.App/ServicesImplementation/Settings/LayoutSettingsService.cs b/src/Files.App/ServicesImplementation/Settings/LayoutSettingsService.cs index 51d91bed7b74..0ad83f8357a2 100644 --- a/src/Files.App/ServicesImplementation/Settings/LayoutSettingsService.cs +++ b/src/Files.App/ServicesImplementation/Settings/LayoutSettingsService.cs @@ -1,6 +1,5 @@ using Files.App.Serialization; using Files.Backend.Services.Settings; -using Files.Shared.Enums; namespace Files.App.ServicesImplementation.Settings { diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml.cs b/src/Files.App/UserControls/InnerNavigationToolbar.xaml.cs index 114eb796d53f..8a48ba10f62b 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml.cs +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml.cs @@ -1,6 +1,5 @@ using CommunityToolkit.Mvvm.DependencyInjection; using Files.App.DataModels; -using Files.App.Helpers; using Files.App.ViewModels; using Files.Backend.Services; using Files.Backend.Services.Settings; diff --git a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs index 6313aa9953d0..6309915d877f 100644 --- a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs @@ -1,23 +1,16 @@ -using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.WinUI; -using CommunityToolkit.WinUI.UI; using Files.App.DataModels.NavigationControlItems; using Files.App.Extensions; using Files.App.Filesystem; using Files.App.Helpers; -using Files.App.Helpers.ContextFlyouts; -using Files.App.Helpers.XamlHelpers; -using Files.App.ServicesImplementation; using Files.App.ViewModels; using Files.App.ViewModels.Widgets; using Files.Backend.Services.Settings; using Files.Shared.Extensions; -using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media.Imaging; using System; diff --git a/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs b/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs index 30a85ebc2f78..c7d33d7d5587 100644 --- a/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs @@ -1,12 +1,10 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using CommunityToolkit.WinUI.UI; +using CommunityToolkit.WinUI.UI; using Files.App.Extensions; using Files.App.Filesystem; using Files.App.Helpers; using Files.App.Helpers.ContextFlyouts; using Files.App.ViewModels; using Files.App.ViewModels.Widgets; -using Files.Backend.Services.Settings; using Files.Backend.ViewModels.Widgets.FileTagsWidget; using Files.Shared.Extensions; using Microsoft.UI.Input; diff --git a/src/Files.App/UserControls/Widgets/HomePageWidget.cs b/src/Files.App/UserControls/Widgets/HomePageWidget.cs index e71c44ae04e5..7f5d6ebdb7ee 100644 --- a/src/Files.App/UserControls/Widgets/HomePageWidget.cs +++ b/src/Files.App/UserControls/Widgets/HomePageWidget.cs @@ -1,29 +1,18 @@ using CommunityToolkit.Mvvm.DependencyInjection; -using CommunityToolkit.WinUI.UI; -using Files.App.DataModels.NavigationControlItems; -using Files.App.Filesystem; using Files.App.Helpers; using Files.App.Helpers.ContextFlyouts; using Files.App.ServicesImplementation; -using Files.App.ServicesImplementation.Settings; -using Files.App.Storage.NativeStorage; using Files.App.ViewModels; using Files.Backend.Services.Settings; using Files.Sdk.Storage; using Files.Shared.Extensions; -using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Input; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; -using Windows.System; -using Windows.UI.Core; namespace Files.App.UserControls.Widgets { diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs index 5b1613765d68..8b90e470aafd 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -1,16 +1,12 @@ -using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.WinUI; -using CommunityToolkit.WinUI.UI; using Files.App.Extensions; using Files.App.Filesystem; using Files.App.Helpers; using Files.App.Helpers.ContextFlyouts; using Files.App.ViewModels; using Files.App.ViewModels.Widgets; -using Files.Backend.Services.Settings; using Files.Shared.Extensions; -using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; @@ -25,9 +21,7 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; -using System.Windows.Input; using Windows.System; -using Windows.UI.Core; namespace Files.App.UserControls.Widgets { diff --git a/src/Files.App/UserControls/Widgets/WidgetCardItem.cs b/src/Files.App/UserControls/Widgets/WidgetCardItem.cs index bda75c518a08..c124e0b8ba44 100644 --- a/src/Files.App/UserControls/Widgets/WidgetCardItem.cs +++ b/src/Files.App/UserControls/Widgets/WidgetCardItem.cs @@ -1,10 +1,4 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Files.Sdk.Storage.LocatableStorage; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Files.App.UserControls.Widgets { diff --git a/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs b/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs index 2036dbe412e2..9e4fd4a12402 100644 --- a/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs +++ b/src/Files.App/ViewModels/SettingsViewModels/FoldersViewModel.cs @@ -1,6 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.DependencyInjection; -using CommunityToolkit.Mvvm.Input; using Files.Backend.Services.Settings; using Files.Shared.Enums; diff --git a/src/Files.App/ViewModels/StatusCenterViewModel.cs b/src/Files.App/ViewModels/StatusCenterViewModel.cs index 3c10563ad3d9..7444a38a20a4 100644 --- a/src/Files.App/ViewModels/StatusCenterViewModel.cs +++ b/src/Files.App/ViewModels/StatusCenterViewModel.cs @@ -5,10 +5,7 @@ using Files.App.Helpers; using Files.App.Interacts; using Files.Shared.Enums; -using Microsoft.UI; -using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Media; using System; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/Files.App/Views/WidgetsPage.xaml.cs b/src/Files.App/Views/WidgetsPage.xaml.cs index bef0154420b0..cbe1959f3180 100644 --- a/src/Files.App/Views/WidgetsPage.xaml.cs +++ b/src/Files.App/Views/WidgetsPage.xaml.cs @@ -1,5 +1,4 @@ using CommunityToolkit.Mvvm.DependencyInjection; -using Files.App.DataModels.NavigationControlItems; using Files.App.Dialogs; using Files.App.Extensions; using Files.App.Filesystem; diff --git a/src/Files.Backend/Services/IQuickAccessService.cs b/src/Files.Backend/Services/IQuickAccessService.cs index 8d98ccd19a60..a7b6ef3afc5e 100644 --- a/src/Files.Backend/Services/IQuickAccessService.cs +++ b/src/Files.Backend/Services/IQuickAccessService.cs @@ -1,5 +1,4 @@ -using Files.Sdk.Storage.LocatableStorage; -using Files.Shared; +using Files.Shared; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs b/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs index 439cd62a16b9..9866f5c441f4 100644 --- a/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs +++ b/src/Files.Backend/Services/Settings/IFoldersSettingsService.cs @@ -1,5 +1,4 @@ -using Files.Sdk.Storage; -using Files.Shared.Enums; +using Files.Shared.Enums; using System.ComponentModel; namespace Files.Backend.Services.Settings diff --git a/src/Files.Backend/Services/Settings/ILayoutSettingsService.cs b/src/Files.Backend/Services/Settings/ILayoutSettingsService.cs index 29c37ca3d0a1..1e3d92bb4295 100644 --- a/src/Files.Backend/Services/Settings/ILayoutSettingsService.cs +++ b/src/Files.Backend/Services/Settings/ILayoutSettingsService.cs @@ -1,5 +1,4 @@ -using Files.Shared.Enums; -using System.ComponentModel; +using System.ComponentModel; namespace Files.Backend.Services.Settings { diff --git a/src/Files.Backend/ViewModels/Widgets/FileTagsWidget/FileTagsContainerViewModel.cs b/src/Files.Backend/ViewModels/Widgets/FileTagsWidget/FileTagsContainerViewModel.cs index cc187faf953d..ec771a9ceb2b 100644 --- a/src/Files.Backend/ViewModels/Widgets/FileTagsWidget/FileTagsContainerViewModel.cs +++ b/src/Files.Backend/ViewModels/Widgets/FileTagsWidget/FileTagsContainerViewModel.cs @@ -7,7 +7,6 @@ using System.Threading; using System.Threading.Tasks; using CommunityToolkit.Mvvm.Input; -using Files.Sdk.Storage.LocatableStorage; namespace Files.Backend.ViewModels.Widgets.FileTagsWidget { From 5ff230b560b9740d18fedb1d60e77de2ff72f89c Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Thu, 16 Feb 2023 00:22:03 +0900 Subject: [PATCH 2/5] Fix: Fixed closing app when the item flyout is open to hang (#11310) --- src/Files.App/App.xaml.cs | 11 +++++++++++ src/Files.App/BaseLayout.cs | 4 ++++ src/Files.App/UserControls/SidebarControl.xaml.cs | 1 + .../UserControls/Widgets/FileTagsWidget.xaml.cs | 1 + src/Files.App/UserControls/Widgets/HomePageWidget.cs | 1 + .../UserControls/Widgets/RecentFilesWidget.xaml.cs | 1 + 6 files changed, 19 insertions(+) diff --git a/src/Files.App/App.xaml.cs b/src/Files.App/App.xaml.cs index 014969cb44ad..baef7548d023 100644 --- a/src/Files.App/App.xaml.cs +++ b/src/Files.App/App.xaml.cs @@ -29,6 +29,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; using Microsoft.Windows.AppLifecycle; using System; using System.Diagnostics; @@ -53,6 +54,7 @@ public partial class App : Application private static bool ShowErrorNotification = false; public static string OutputPath { get; set; } + public static CommandBarFlyout? LastOpenedFlyout { get; set; } public static StorageHistoryWrapper HistoryWrapper = new StorageHistoryWrapper(); public static SettingsViewModel AppSettings { get; private set; } public static AppModel AppModel { get; private set; } @@ -286,6 +288,15 @@ private async void Window_Closed(object sender, WindowEventArgs args) { // Save application state and stop any background activity + // A Workaround for the crash (#10110) + if (LastOpenedFlyout?.IsOpen ?? false) + { + args.Handled = true; + LastOpenedFlyout.Closed += (sender, e) => App.Current.Exit(); + LastOpenedFlyout.Hide(); + return; + } + await Task.Yield(); // Method can take a long time, make sure the window is hidden SaveSessionTabs(); diff --git a/src/Files.App/BaseLayout.cs b/src/Files.App/BaseLayout.cs index 21759ce74dbb..0d334059557f 100644 --- a/src/Files.App/BaseLayout.cs +++ b/src/Files.App/BaseLayout.cs @@ -556,6 +556,8 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) public async void ItemContextFlyout_Opening(object? sender, object e) { + App.LastOpenedFlyout = sender as CommandBarFlyout; + try { if (!IsItemSelected && ((sender as CommandBarFlyout)?.Target as ListViewItem)?.Content is ListedItem li) // Workaround for item sometimes not getting selected @@ -574,6 +576,8 @@ public async void ItemContextFlyout_Opening(object? sender, object e) public async void BaseContextFlyout_Opening(object? sender, object e) { + App.LastOpenedFlyout = sender as CommandBarFlyout; + try { // Reset menu max height diff --git a/src/Files.App/UserControls/SidebarControl.xaml.cs b/src/Files.App/UserControls/SidebarControl.xaml.cs index 90667df4cf35..3199067348fc 100644 --- a/src/Files.App/UserControls/SidebarControl.xaml.cs +++ b/src/Files.App/UserControls/SidebarControl.xaml.cs @@ -420,6 +420,7 @@ private void PaneRoot_RightTapped(object sender, RightTappedRoutedEventArgs e) private void NavigationViewItem_RightTapped(object sender, RightTappedRoutedEventArgs e) { var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full }; + itemContextMenuFlyout.Opening += (sender, e) => App.LastOpenedFlyout = sender as CommandBarFlyout; if (sender is not NavigationViewItem sidebarItem || sidebarItem.DataContext is not INavigationControlItem item) return; diff --git a/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs b/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs index c7d33d7d5587..23acf1fc2e5e 100644 --- a/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/FileTagsWidget.xaml.cs @@ -63,6 +63,7 @@ private async void FileTagItem_ItemClick(object sender, ItemClickEventArgs e) private void Item_RightTapped(object sender, RightTappedRoutedEventArgs e) { var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full }; + itemContextMenuFlyout.Opening += (sender, e) => App.LastOpenedFlyout = sender as CommandBarFlyout; if (sender is not StackPanel tagsItemsStackPanel || tagsItemsStackPanel.DataContext is not FileTagsItemViewModel item) return; itemContextMenuFlyout.ShowAt(tagsItemsStackPanel, new FlyoutShowOptions { Position = e.GetPosition(tagsItemsStackPanel) }); diff --git a/src/Files.App/UserControls/Widgets/HomePageWidget.cs b/src/Files.App/UserControls/Widgets/HomePageWidget.cs index 7f5d6ebdb7ee..2f2bb6b49b35 100644 --- a/src/Files.App/UserControls/Widgets/HomePageWidget.cs +++ b/src/Files.App/UserControls/Widgets/HomePageWidget.cs @@ -36,6 +36,7 @@ public abstract class HomePageWidget : UserControl public void Button_RightTapped(object sender, RightTappedRoutedEventArgs e) { var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full }; + itemContextMenuFlyout.Opening += (sender, e) => App.LastOpenedFlyout = sender as CommandBarFlyout; if (sender is not Button widgetCardItem || widgetCardItem.DataContext is not WidgetCardItem item) return; diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs index 8b90e470aafd..4da721f4d626 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -103,6 +103,7 @@ public RecentFilesWidget() private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e) { var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full }; + itemContextMenuFlyout.Opening += (sender, e) => App.LastOpenedFlyout = sender as CommandBarFlyout; if (sender is not Grid recentItemsGrid || recentItemsGrid.DataContext is not RecentItem item) return; From dc676d30a6e01836683e9bde4bed88ac92f65be5 Mon Sep 17 00:00:00 2001 From: Filippo Ferrario <102259289+ferrariofilippo@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:00:42 +0100 Subject: [PATCH 3/5] Code Quality: Shell page refactoring (#11034) --- src/Files.App/Views/BaseShellPage.cs | 756 ++++++++++++++++++ src/Files.App/Views/ColumnShellPage.xaml | 13 +- src/Files.App/Views/ColumnShellPage.xaml.cs | 837 +------------------- src/Files.App/Views/ModernShellPage.xaml | 13 +- src/Files.App/Views/ModernShellPage.xaml.cs | 750 +----------------- 5 files changed, 850 insertions(+), 1519 deletions(-) create mode 100644 src/Files.App/Views/BaseShellPage.cs diff --git a/src/Files.App/Views/BaseShellPage.cs b/src/Files.App/Views/BaseShellPage.cs new file mode 100644 index 000000000000..763e99a706b0 --- /dev/null +++ b/src/Files.App/Views/BaseShellPage.cs @@ -0,0 +1,756 @@ +using CommunityToolkit.Mvvm.DependencyInjection; +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.WinUI; +using Files.App.DataModels; +using Files.App.EventArguments; +using Files.App.Extensions; +using Files.App.Filesystem; +using Files.App.Filesystem.FilesystemHistory; +using Files.App.Filesystem.Search; +using Files.App.Helpers; +using Files.App.UserControls; +using Files.App.UserControls.MultitaskingControl; +using Files.App.ViewModels; +using Files.App.Views.LayoutModes; +using Files.Backend.Enums; +using Files.Backend.Services; +using Files.Backend.Services.Settings; +using Files.Shared; +using Files.Shared.Enums; +using Microsoft.UI.Input; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Animation; +using Microsoft.UI.Xaml.Navigation; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using Windows.Storage; +using Windows.System; +using Windows.UI.Core; +using SortDirection = Files.Shared.Enums.SortDirection; + +namespace Files.App.Views +{ + public abstract class BaseShellPage : Page, IShellPage, INotifyPropertyChanged + { + public static readonly DependencyProperty NavParamsProperty = + DependencyProperty.Register("NavParams", typeof(NavigationParams), typeof(ModernShellPage), new PropertyMetadata(null)); + + protected readonly StorageHistoryHelpers storageHistoryHelpers; + + protected readonly CancellationTokenSource cancellationTokenSource; + + protected readonly IDialogService dialogService = Ioc.Default.GetRequiredService(); + + protected readonly IUserSettingsService userSettingsService = Ioc.Default.GetRequiredService(); + + protected readonly IUpdateService updateSettingsService = Ioc.Default.GetRequiredService(); + + public ToolbarViewModel ToolbarViewModel { get; } = new ToolbarViewModel(); + + public IBaseLayout SlimContentPage => ContentPage; + + public IFilesystemHelpers FilesystemHelpers { get; protected set; } + + public Type CurrentPageType => ItemDisplay.SourcePageType; + + public FolderSettingsViewModel FolderSettings => InstanceViewModel.FolderSettings; + + public AppModel AppModel => App.AppModel; + + protected abstract Frame ItemDisplay { get; } + + public abstract bool CanNavigateForward { get; } + + public abstract bool CanNavigateBackward { get; } + + public bool IsColumnView => SlimContentPage is ColumnViewBrowser; + + public ItemViewModel FilesystemViewModel { get; protected set; } + + public CurrentInstanceViewModel InstanceViewModel { get; } + + protected BaseLayout contentPage; + public BaseLayout ContentPage + { + get => contentPage; + set + { + if (value != contentPage) + { + contentPage = value; + NotifyPropertyChanged(nameof(ContentPage)); + NotifyPropertyChanged(nameof(SlimContentPage)); + } + } + } + + protected bool isPageMainPane; + public bool IsPageMainPane + { + get => isPageMainPane; + set + { + if (value != isPageMainPane) + { + isPageMainPane = value; + NotifyPropertyChanged(nameof(IsPageMainPane)); + } + } + } + + protected IPaneHolder paneHolder; + public IPaneHolder PaneHolder + { + get => paneHolder; + set + { + if (value != paneHolder) + { + paneHolder = value; + NotifyPropertyChanged(nameof(PaneHolder)); + } + } + } + + protected TabItemArguments tabItemArguments; + public TabItemArguments TabItemArguments + { + get => tabItemArguments; + set + { + if (tabItemArguments != value) + { + tabItemArguments = value; + ContentChanged?.Invoke(this, value); + } + } + } + + protected bool isCurrentInstance = false; + public bool IsCurrentInstance + { + get => isCurrentInstance; + set + { + if (isCurrentInstance != value) + { + isCurrentInstance = value; + if (isCurrentInstance) + ContentPage?.ItemManipulationModel.FocusFileList(); + else if (SlimContentPage is not ColumnViewBrowser) + ToolbarViewModel.IsEditModeEnabled = false; + NotifyPropertyChanged(nameof(IsCurrentInstance)); + } + } + } + + public SolidColorBrush CurrentInstanceBorderBrush + { + get { return (SolidColorBrush)GetValue(CurrentInstanceBorderBrushProperty); } + set { SetValue(CurrentInstanceBorderBrushProperty, value); } + } + + public static readonly DependencyProperty CurrentInstanceBorderBrushProperty = + DependencyProperty.Register("CurrentInstanceBorderBrush", typeof(SolidColorBrush), typeof(ModernShellPage), new PropertyMetadata(null)); + + public event PropertyChangedEventHandler PropertyChanged; + + public event EventHandler ContentChanged; + + public BaseShellPage(CurrentInstanceViewModel instanceViewModel) + { + InstanceViewModel = instanceViewModel; + InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired += FolderSettings_LayoutPreferencesUpdateRequired; + cancellationTokenSource = new CancellationTokenSource(); + FilesystemHelpers = new FilesystemHelpers(this, cancellationTokenSource.Token); + storageHistoryHelpers = new StorageHistoryHelpers(new StorageHistoryOperations(this, cancellationTokenSource.Token)); + + ToolbarViewModel.InstanceViewModel = InstanceViewModel; + + InitToolbarCommands(); + + DisplayFilesystemConsentDialog(); + + /*TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK + Use your ResourceManager instance to create a ResourceContext as below.If you already have a ResourceManager instance, + replace the new instance created below with correct instance. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore + */ + var flowDirectionSetting = new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; + + if (flowDirectionSetting == "RTL") + FlowDirection = FlowDirection.RightToLeft; + + ToolbarViewModel.ToolbarPathItemInvoked += ShellPage_NavigationRequested; + ToolbarViewModel.ToolbarFlyoutOpened += ShellPage_ToolbarFlyoutOpened; + ToolbarViewModel.ToolbarPathItemLoaded += ShellPage_ToolbarPathItemLoaded; + ToolbarViewModel.AddressBarTextEntered += ShellPage_AddressBarTextEntered; + ToolbarViewModel.PathBoxItemDropped += ShellPage_PathBoxItemDropped; + + ToolbarViewModel.BackRequested += ShellPage_BackNavRequested; + ToolbarViewModel.UpRequested += ShellPage_UpNavRequested; + ToolbarViewModel.RefreshRequested += ShellPage_RefreshRequested; + ToolbarViewModel.ForwardRequested += ShellPage_ForwardNavRequested; + ToolbarViewModel.EditModeEnabled += NavigationToolbar_EditModeEnabled; + ToolbarViewModel.ItemDraggedOverPathItem += ShellPage_NavigationRequested; + ToolbarViewModel.PathBoxQuerySubmitted += NavigationToolbar_QuerySubmitted; + ToolbarViewModel.SearchBox.TextChanged += ShellPage_TextChanged; + ToolbarViewModel.SearchBox.QuerySubmitted += ShellPage_QuerySubmitted; + + InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated += AppSettings_SortDirectionPreferenceUpdated; + InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated += AppSettings_SortOptionPreferenceUpdated; + InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated += AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; + + this.PointerPressed += CoreWindow_PointerPressed; + + /* + TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. + The tool has generated a custom back button in the MainWindow.xaml.cs file. + Feel free to edit its position, behavior and use the custom back button instead. + Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality + */ + + App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged; + + PreviewKeyDown += ShellPage_PreviewKeyDown; + } + + protected void NotifyPropertyChanged([CallerMemberName] string propertyName = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + protected void FilesystemViewModel_PageTypeUpdated(object sender, PageTypeUpdatedEventArgs e) + { + InstanceViewModel.IsPageTypeCloudDrive = e.IsTypeCloudDrive; + } + + protected void FilesystemViewModel_OnSelectionRequestedEvent(object sender, List e) + { + // set focus since selection might occur before the UI finishes updating + ContentPage.ItemManipulationModel.FocusFileList(); + ContentPage.ItemManipulationModel.SetSelectedItems(e); + } + + protected void FilesystemViewModel_DirectoryInfoUpdated(object sender, EventArgs e) + { + if (ContentPage is null) + return; + + var directoryItemCountLocalization = (FilesystemViewModel.FilesAndFolders.Count == 1) + ? "ItemCount/Text".GetLocalizedResource() + : "ItemsCount/Text".GetLocalizedResource(); + + ContentPage.DirectoryPropertiesViewModel.DirectoryItemCount = $"{FilesystemViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}"; + ContentPage.UpdateSelectionSize(); + } + + protected virtual void Page_Loaded(object sender, RoutedEventArgs e) + { + OnNavigationParamsChanged(); + this.Loaded -= Page_Loaded; + } + + /** + * Some keys are overriden by control built-in defaults (e.g. 'Space'). + * They must be handled here since they're not propagated to KeyboardAccelerator. + */ + protected void ShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs args) + { + var ctrl = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); + var shift = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); + var alt = InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); + var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || + CurrentPageType == typeof(GridViewBrowser) || + CurrentPageType == typeof(ColumnViewBrowser) || + CurrentPageType == typeof(ColumnViewBase); + + switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.Key) + { + // Ctrl + ` (accent key), open terminal + case (true, false, false, true, (VirtualKey)192): + + // Check if there is a folder selected, if not use the current directory. + string path = FilesystemViewModel.WorkingDirectory; + if (SlimContentPage?.SelectedItem?.PrimaryItemAttribute == StorageItemTypes.Folder) + path = SlimContentPage.SelectedItem.ItemPath; + + var terminalStartInfo = new ProcessStartInfo() + { + FileName = "wt.exe", + Arguments = $"-d {path}", + Verb = shift ? "runas" : "", + UseShellExecute = true + }; + DispatcherQueue.TryEnqueue(() => Process.Start(terminalStartInfo)); + + args.Handled = true; + + break; + + // Ctrl + space, toggle media playback + case (true, false, false, true, VirtualKey.Space): + + if (App.PreviewPaneViewModel.PreviewPaneContent is UserControls.FilePreviews.MediaPreview mediaPreviewContent) + { + mediaPreviewContent.ViewModel.TogglePlayback(); + args.Handled = true; + } + + break; + } + } + + protected async void ShellPage_QuerySubmitted(ISearchBox sender, SearchBoxQuerySubmittedEventArgs e) + { + if (e.ChosenSuggestion is SuggestionModel item && !string.IsNullOrWhiteSpace(item.ItemPath)) + await NavigationHelpers.OpenPath(item.ItemPath, this); + else if (e.ChosenSuggestion is null && !string.IsNullOrWhiteSpace(sender.Query)) + SubmitSearch(sender.Query, userSettingsService.PreferencesSettingsService.SearchUnindexedItems); + } + + protected async void ShellPage_TextChanged(ISearchBox sender, SearchBoxTextChangedEventArgs e) + { + if (e.Reason != SearchBoxTextChangeReason.UserInput) + return; + if (!string.IsNullOrWhiteSpace(sender.Query)) + { + var search = new FolderSearch + { + Query = sender.Query, + Folder = FilesystemViewModel.WorkingDirectory, + MaxItemCount = 10, + SearchUnindexedItems = userSettingsService.PreferencesSettingsService.SearchUnindexedItems + }; + sender.SetSuggestions((await search.SearchAsync()).Select(suggestion => new SuggestionModel(suggestion))); + } + else + { + sender.AddRecentQueries(); + } + } + + protected void ShellPage_RefreshRequested(object sender, EventArgs e) + { + Refresh_Click(); + } + + protected void ShellPage_UpNavRequested(object sender, EventArgs e) + { + Up_Click(); + } + + protected void ShellPage_ForwardNavRequested(object sender, EventArgs e) + { + Forward_Click(); + } + + protected void ShellPage_BackNavRequested(object sender, EventArgs e) + { + Back_Click(); + } + + protected void AppSettings_SortDirectionPreferenceUpdated(object sender, SortDirection e) + { + FilesystemViewModel?.UpdateSortDirectionStatus(); + } + + protected void AppSettings_SortOptionPreferenceUpdated(object sender, SortOption e) + { + FilesystemViewModel?.UpdateSortOptionStatus(); + } + + protected void AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated(object sender, bool e) + { + FilesystemViewModel?.UpdateSortDirectoriesAlongsideFiles(); + } + + protected void CoreWindow_PointerPressed(object sender, PointerRoutedEventArgs args) + { + if (!IsCurrentInstance) + return; + if (args.GetCurrentPoint(this).Properties.IsXButton1Pressed) + Back_Click(); + else if (args.GetCurrentPoint(this).Properties.IsXButton2Pressed) + Forward_Click(); + } + + protected async void ShellPage_PathBoxItemDropped(object sender, PathBoxItemDroppedEventArgs e) + { + await FilesystemHelpers.PerformOperationTypeAsync(e.AcceptedOperation, e.Package, e.Path, false, true); + e.SignalEvent?.Set(); + } + + protected void ShellPage_AddressBarTextEntered(object sender, AddressBarTextEnteredEventArgs e) + { + ToolbarViewModel.SetAddressBarSuggestions(e.AddressBarTextField, this); + } + + protected async void ShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathItemLoadedEventArgs e) + { + await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, e.Item, this); + } + + protected async void ShellPage_ToolbarFlyoutOpened(object sender, ToolbarFlyoutOpenedEventArgs e) + { + await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, (e.OpenedFlyout.Target as FontIcon).DataContext as PathBoxItem, this); + } + + protected async void NavigationToolbar_QuerySubmitted(object sender, ToolbarQuerySubmittedEventArgs e) + { + await ToolbarViewModel.CheckPathInput(e.QueryText, ToolbarViewModel.PathComponents.LastOrDefault()?.Path, this); + } + + protected void NavigationToolbar_EditModeEnabled(object sender, EventArgs e) + { + ToolbarViewModel.ManualEntryBoxLoaded = true; + ToolbarViewModel.ClickablePathLoaded = false; + ToolbarViewModel.PathText = string.IsNullOrEmpty(FilesystemViewModel?.WorkingDirectory) + ? CommonPaths.HomePath + : FilesystemViewModel.WorkingDirectory; + } + + protected void DrivesManager_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "ShowUserConsentOnInit") + DisplayFilesystemConsentDialog(); + } + + /* + * Ensure that the path bar gets updated for user interaction + * whenever the path changes. We will get the individual directories from + * the updated, most-current path and add them to the UI. + */ + public void UpdatePathUIToWorkingDirectory(string newWorkingDir, string singleItemOverride = null) + { + if (string.IsNullOrWhiteSpace(singleItemOverride)) + { + var components = StorageFileExtensions.GetDirectoryPathComponents(newWorkingDir); + var lastCommonItemIndex = ToolbarViewModel.PathComponents + .Select((value, index) => new { value, index }) + .LastOrDefault(x => x.index < components.Count && x.value.Path == components[x.index].Path)?.index ?? 0; + + while (ToolbarViewModel.PathComponents.Count > lastCommonItemIndex) + ToolbarViewModel.PathComponents.RemoveAt(lastCommonItemIndex); + + foreach (var component in components.Skip(lastCommonItemIndex)) + ToolbarViewModel.PathComponents.Add(component); + } + else + { + // Clear the path UI + ToolbarViewModel.PathComponents.Clear(); + ToolbarViewModel.IsSingleItemOverride = true; + ToolbarViewModel.PathComponents.Add(new PathBoxItem() { Path = null, Title = singleItemOverride }); + } + } + + public void SubmitSearch(string query, bool searchUnindexedItems) + { + FilesystemViewModel.CancelSearch(); + InstanceViewModel.CurrentSearchQuery = query; + InstanceViewModel.SearchedUnindexedItems = searchUnindexedItems; + ItemDisplay.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), new NavigationArguments() + { + AssociatedTabInstance = this, + IsSearchResultPage = true, + SearchPathParam = FilesystemViewModel.WorkingDirectory, + SearchQuery = query, + SearchUnindexedItems = searchUnindexedItems, + }); + } + + public void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs) + { + NavigateToPath(navArgs.NavPathParam, sourcePageType, navArgs); + } + + public void NavigateToPath(string navigationPath, NavigationArguments? navArgs = null) + { + NavigateToPath(navigationPath, FolderSettings.GetLayoutType(navigationPath), navArgs); + } + + public Task TabItemDragOver(object sender, DragEventArgs e) + { + return SlimContentPage?.CommandsViewModel.CommandsModel.DragOver(e); + } + + public Task TabItemDrop(object sender, DragEventArgs e) + { + return SlimContentPage?.CommandsViewModel.CommandsModel.Drop(e); + } + + public async void Refresh_Click() + { + if (InstanceViewModel.IsPageTypeSearchResults) + { + ToolbarViewModel.CanRefresh = false; + var searchInstance = new FolderSearch + { + Query = InstanceViewModel.CurrentSearchQuery ?? (string)TabItemArguments.NavigationArg, + Folder = FilesystemViewModel.WorkingDirectory, + ThumbnailSize = InstanceViewModel.FolderSettings.GetIconSize(), + SearchUnindexedItems = InstanceViewModel.SearchedUnindexedItems + }; + await FilesystemViewModel.SearchAsync(searchInstance); + } + else if (CurrentPageType != typeof(WidgetsPage)) + { + ToolbarViewModel.CanRefresh = false; + FilesystemViewModel?.RefreshItems(null); + } + } + + public virtual void Back_Click() + { + var previousPageContent = ItemDisplay.BackStack[ItemDisplay.BackStack.Count - 1]; + HandleBackForwardRequest(previousPageContent); + + if (previousPageContent.SourcePageType == typeof(WidgetsPage)) + ItemDisplay.GoBack(new EntranceNavigationTransitionInfo()); + else + ItemDisplay.GoBack(); + } + + public virtual void Forward_Click() + { + var incomingPageContent = ItemDisplay.ForwardStack[ItemDisplay.ForwardStack.Count - 1]; + HandleBackForwardRequest(incomingPageContent); + ItemDisplay.GoForward(); + } + + public void RemoveLastPageFromBackStack() + { + ItemDisplay.BackStack.Remove(ItemDisplay.BackStack.Last()); + } + + public void RaiseContentChanged(IShellPage instance, TabItemArguments args) + { + ContentChanged?.Invoke(instance, args); + } + + protected void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoadStatusChangedEventArgs e) + { + switch (e.Status) + { + case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Starting: + ToolbarViewModel.CanRefresh = false; + SetLoadingIndicatorForTabs(true); + break; + + case ItemLoadStatusChangedEventArgs.ItemLoadStatus.InProgress: + var columnCanNavigateBackward = false; + var columnCanNavigateForward = false; + if (SlimContentPage is ColumnViewBrowser browser) + { + columnCanNavigateBackward = browser.ParentShellPageInstance.CanNavigateBackward; + columnCanNavigateForward = browser.ParentShellPageInstance.CanNavigateForward; + } + ToolbarViewModel.CanGoBack = ItemDisplay.CanGoBack || columnCanNavigateBackward; + ToolbarViewModel.CanGoForward = ItemDisplay.CanGoForward || columnCanNavigateForward; + SetLoadingIndicatorForTabs(true); + break; + + case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Complete: + SetLoadingIndicatorForTabs(false); + ToolbarViewModel.CanRefresh = true; + // Select previous directory + if (!string.IsNullOrWhiteSpace(e.PreviousDirectory) && + e.PreviousDirectory.Contains(e.Path, StringComparison.Ordinal) && !e.PreviousDirectory.Contains(CommonPaths.RecycleBinPath, StringComparison.Ordinal)) + { + // Remove the WorkingDir from previous dir + e.PreviousDirectory = e.PreviousDirectory.Replace(e.Path, string.Empty, StringComparison.Ordinal); + + // Get previous dir name + if (e.PreviousDirectory.StartsWith('\\')) + e.PreviousDirectory = e.PreviousDirectory.Remove(0, 1); + if (e.PreviousDirectory.Contains('\\')) + e.PreviousDirectory = e.PreviousDirectory.Split('\\')[0]; + + // Get the first folder and combine it with WorkingDir + string folderToSelect = string.Format("{0}\\{1}", e.Path, e.PreviousDirectory); + + // Make sure we don't get double \\ in the e.Path + folderToSelect = folderToSelect.Replace("\\\\", "\\", StringComparison.Ordinal); + + if (folderToSelect.EndsWith('\\')) + folderToSelect = folderToSelect.Remove(folderToSelect.Length - 1, 1); + + var itemToSelect = FilesystemViewModel.FilesAndFolders.Where((item) => item.ItemPath == folderToSelect).FirstOrDefault(); + + if (itemToSelect is not null && ContentPage is not null) + { + ContentPage.ItemManipulationModel.SetSelectedItem(itemToSelect); + ContentPage.ItemManipulationModel.ScrollIntoView(itemToSelect); + } + } + break; + } + } + + protected virtual void FolderSettings_LayoutPreferencesUpdateRequired(object sender, LayoutPreferenceEventArgs e) + { + } + + protected virtual void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e) + { + } + + protected virtual void OnNavigationParamsChanged() + { + } + + protected virtual void ShellPage_NavigationRequested(object sender, PathNavigationEventArgs e) + { + } + + protected void InitToolbarCommands() + { + ToolbarViewModel.SelectAllContentPageItemsCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.SelectAllItems()); + ToolbarViewModel.InvertContentPageSelctionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.InvertSelection()); + ToolbarViewModel.ClearContentPageSelectionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.ClearSelection()); + ToolbarViewModel.PasteItemsFromClipboardCommand = new RelayCommand(async () => await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this)); + ToolbarViewModel.OpenNewWindowCommand = new AsyncRelayCommand(NavigationHelpers.LaunchNewWindowAsync); + ToolbarViewModel.OpenNewPaneCommand = new RelayCommand(() => PaneHolder?.OpenPathInNewPane("Home".GetLocalizedResource())); + ToolbarViewModel.ClosePaneCommand = new RelayCommand(() => PaneHolder?.CloseActivePane()); + ToolbarViewModel.CreateNewFileCommand = new RelayCommand(x => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.File, x, this)); + ToolbarViewModel.CreateNewFolderCommand = new RelayCommand(() => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.Folder, null, this)); + ToolbarViewModel.CreateNewShortcutCommand = new RelayCommand(() => CreateNewShortcutFromDialog()); + ToolbarViewModel.CopyCommand = new RelayCommand(async () => await UIFilesystemHelpers.CopyItem(this)); + ToolbarViewModel.Rename = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RenameItemCommand.Execute(null)); + ToolbarViewModel.Share = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShareItemCommand.Execute(null)); + ToolbarViewModel.DeleteCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DeleteItemCommand.Execute(null)); + ToolbarViewModel.CutCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.CutItemCommand.Execute(null)); + ToolbarViewModel.EmptyRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.EmptyRecycleBinCommand.Execute(null)); + ToolbarViewModel.RestoreRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreRecycleBinCommand.Execute(null)); + ToolbarViewModel.RestoreSelectionRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreSelectionRecycleBinCommand.Execute(null)); + ToolbarViewModel.RunWithPowerShellCommand = new RelayCommand(async () => await Win32Helpers.InvokeWin32ComponentAsync("powershell", this, PathNormalization.NormalizePath(SlimContentPage?.SelectedItem.ItemPath))); + ToolbarViewModel.PropertiesCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShowPropertiesCommand.Execute(null)); + ToolbarViewModel.SetAsBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsDesktopBackgroundItemCommand.Execute(null)); + ToolbarViewModel.SetAsLockscreenBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsLockscreenBackgroundItemCommand.Execute(null)); + ToolbarViewModel.SetAsSlideshowCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsSlideshowItemCommand.Execute(null)); + ToolbarViewModel.ExtractCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveCommand.Execute(null)); + ToolbarViewModel.ExtractHereCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveHereCommand.Execute(null)); + ToolbarViewModel.ExtractToCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveToChildFolderCommand.Execute(null)); + ToolbarViewModel.InstallInfCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallInfDriver.Execute(null)); + ToolbarViewModel.RotateImageLeftCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.CanExecute(null) == true); + ToolbarViewModel.RotateImageRightCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.CanExecute(null) == true); + ToolbarViewModel.InstallFontCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallFontCommand.Execute(null)); + ToolbarViewModel.UpdateCommand = new AsyncRelayCommand(async () => await updateSettingsService.DownloadUpdates()); + } + + protected async Task GetContentOrNullAsync() + { + // WINUI3: make sure not to run this synchronously, do not use EnqueueAsync + var tcs = new TaskCompletionSource(); + DispatcherQueue.TryEnqueue(() => + { + tcs.SetResult(ItemDisplay.Content); + }); + return await tcs.Task as BaseLayout; + } + + protected async void DisplayFilesystemConsentDialog() + { + if (App.DrivesManager?.ShowUserConsentOnInit ?? false) + { + App.DrivesManager.ShowUserConsentOnInit = false; + await DispatcherQueue.EnqueueAsync(async () => + { + var dialog = DynamicDialogFactory.GetFor_ConsentDialog(); + await SetContentDialogRoot(dialog).ShowAsync(ContentDialogPlacement.Popup); + }); + } + } + + protected void SelectSidebarItemFromPath(Type incomingSourcePageType = null) + { + if (incomingSourcePageType == typeof(WidgetsPage) && incomingSourcePageType is not null) + ToolbarViewModel.PathControlDisplayText = "Home".GetLocalizedResource(); + } + + protected void SetLoadingIndicatorForTabs(bool isLoading) + { + var multitaskingControls = ((App.Window.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; + + foreach (var x in multitaskingControls) + x.SetLoadingIndicatorStatus(x.Items.FirstOrDefault(x => x.Control.TabItemContent == PaneHolder), isLoading); + } + + protected async void CreateNewShortcutFromDialog() + { + await UIFilesystemHelpers.CreateShortcutFromDialogAsync(this); + } + + // WINUI3 + protected static ContentDialog SetContentDialogRoot(ContentDialog contentDialog) + { + if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + contentDialog.XamlRoot = App.Window.Content.XamlRoot; + return contentDialog; + } + + private void HandleBackForwardRequest(PageStackEntry pageContent) + { + var incomingPageNavPath = pageContent.Parameter as NavigationArguments; + incomingPageNavPath.IsLayoutSwitch = false; + if (pageContent.SourcePageType != typeof(WidgetsPage)) // Update layout type + InstanceViewModel.FolderSettings.GetLayoutType(incomingPageNavPath.IsSearchResultPage ? incomingPageNavPath.SearchPathParam : incomingPageNavPath.NavPathParam); + SelectSidebarItemFromPath(pageContent.SourcePageType); + } + + public abstract void Up_Click(); + + public abstract void NavigateHome(); + + public abstract void NavigateToPath(string? navigationPath, Type? sourcePageType, NavigationArguments? navArgs = null); + + public virtual void Dispose() + { + PreviewKeyDown -= ShellPage_PreviewKeyDown; + PointerPressed -= CoreWindow_PointerPressed; + App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged; + + ToolbarViewModel.ToolbarPathItemInvoked -= ShellPage_NavigationRequested; + ToolbarViewModel.ToolbarFlyoutOpened -= ShellPage_ToolbarFlyoutOpened; + ToolbarViewModel.ToolbarPathItemLoaded -= ShellPage_ToolbarPathItemLoaded; + ToolbarViewModel.AddressBarTextEntered -= ShellPage_AddressBarTextEntered; + ToolbarViewModel.PathBoxItemDropped -= ShellPage_PathBoxItemDropped; + ToolbarViewModel.BackRequested -= ShellPage_BackNavRequested; + ToolbarViewModel.UpRequested -= ShellPage_UpNavRequested; + ToolbarViewModel.RefreshRequested -= ShellPage_RefreshRequested; + ToolbarViewModel.ForwardRequested -= ShellPage_ForwardNavRequested; + ToolbarViewModel.EditModeEnabled -= NavigationToolbar_EditModeEnabled; + ToolbarViewModel.ItemDraggedOverPathItem -= ShellPage_NavigationRequested; + ToolbarViewModel.PathBoxQuerySubmitted -= NavigationToolbar_QuerySubmitted; + ToolbarViewModel.SearchBox.TextChanged -= ShellPage_TextChanged; + + InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired -= FolderSettings_LayoutPreferencesUpdateRequired; + InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated -= AppSettings_SortDirectionPreferenceUpdated; + InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated -= AppSettings_SortOptionPreferenceUpdated; + InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated -= AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; + + if (FilesystemViewModel is not null) // Prevent weird case of this being null when many tabs are opened/closed quickly + { + FilesystemViewModel.WorkingDirectoryModified -= ViewModel_WorkingDirectoryModified; + FilesystemViewModel.ItemLoadStatusChanged -= FilesystemViewModel_ItemLoadStatusChanged; + FilesystemViewModel.DirectoryInfoUpdated -= FilesystemViewModel_DirectoryInfoUpdated; + FilesystemViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated; + FilesystemViewModel.OnSelectionRequestedEvent -= FilesystemViewModel_OnSelectionRequestedEvent; + FilesystemViewModel.Dispose(); + } + + if (ItemDisplay.Content is IDisposable disposableContent) + disposableContent?.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Files.App/Views/ColumnShellPage.xaml b/src/Files.App/Views/ColumnShellPage.xaml index c78f44c454c9..55a8462029e7 100644 --- a/src/Files.App/Views/ColumnShellPage.xaml +++ b/src/Files.App/Views/ColumnShellPage.xaml @@ -1,25 +1,26 @@ - - + - + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Files.App/Views/ColumnShellPage.xaml.cs b/src/Files.App/Views/ColumnShellPage.xaml.cs index 110602e9ac41..f85bbddea553 100644 --- a/src/Files.App/Views/ColumnShellPage.xaml.cs +++ b/src/Files.App/Views/ColumnShellPage.xaml.cs @@ -1,401 +1,36 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using CommunityToolkit.Mvvm.Input; -using CommunityToolkit.WinUI; using CommunityToolkit.WinUI.UI; -using Files.App.DataModels; -using Files.App.Dialogs; -using Files.App.EventArguments; -using Files.App.Extensions; using Files.App.Filesystem; -using Files.App.Filesystem.FilesystemHistory; -using Files.App.Filesystem.Search; using Files.App.Helpers; using Files.App.UserControls; using Files.App.UserControls.MultitaskingControl; using Files.App.ViewModels; using Files.App.Views.LayoutModes; using Files.Backend.Enums; -using Files.Backend.Services; -using Files.Backend.Services.Settings; using Files.Backend.ViewModels.Dialogs.AddItemDialog; -using Files.Shared; using Files.Shared.Enums; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; using Windows.Storage; using Windows.System; -using Windows.UI.Core; -using SortDirection = Files.Shared.Enums.SortDirection; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 namespace Files.App.Views { - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class ColumnShellPage : Page, IShellPage, INotifyPropertyChanged + public sealed partial class ColumnShellPage : BaseShellPage { - private readonly StorageHistoryHelpers storageHistoryHelpers; - public IBaseLayout SlimContentPage => ContentPage; - public IFilesystemHelpers FilesystemHelpers { get; private set; } - private readonly CancellationTokenSource cancellationTokenSource; - - public bool CanNavigateBackward => false; - public bool CanNavigateForward => false; - - public FolderSettingsViewModel FolderSettings => InstanceViewModel?.FolderSettings; - - public AppModel AppModel => App.AppModel; - - public bool IsColumnView { get; } = true; - - private readonly IDialogService dialogService = Ioc.Default.GetRequiredService(); - - private IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetRequiredService(); - - private readonly IUpdateService updateSettingsService = Ioc.Default.GetRequiredService(); - - private bool isCurrentInstance = false; - public bool IsCurrentInstance - { - get => isCurrentInstance; - set - { - if (isCurrentInstance != value) - { - isCurrentInstance = value; - if (isCurrentInstance) - { - ContentPage?.ItemManipulationModel.FocusFileList(); - } - //else - //{ - // NavigationToolbar.IsEditModeEnabled = false; - //} - NotifyPropertyChanged(nameof(IsCurrentInstance)); - } - } - } + public override bool CanNavigateBackward => false; + public override bool CanNavigateForward => false; - public ItemViewModel FilesystemViewModel { get; private set; } = null; - public CurrentInstanceViewModel InstanceViewModel { get; } - private BaseLayout contentPage = null; + protected override Frame ItemDisplay => ItemDisplayFrame; - public BaseLayout ContentPage - { - get => contentPage; - set - { - if (value != contentPage) - { - contentPage = value; - NotifyPropertyChanged(nameof(ContentPage)); - NotifyPropertyChanged(nameof(SlimContentPage)); - } - } - } - - private bool isPageMainPane; - - public bool IsPageMainPane - { - get => isPageMainPane; - set - { - if (value != isPageMainPane) - { - isPageMainPane = value; - NotifyPropertyChanged(nameof(IsPageMainPane)); - } - } - } - - public SolidColorBrush CurrentInstanceBorderBrush - { - get { return (SolidColorBrush)GetValue(CurrentInstanceBorderBrushProperty); } - set { SetValue(CurrentInstanceBorderBrushProperty, value); } - } - - public static readonly DependencyProperty CurrentInstanceBorderBrushProperty = - DependencyProperty.Register("CurrentInstanceBorderBrush", typeof(SolidColorBrush), typeof(ColumnShellPage), new PropertyMetadata(null)); - - public Type CurrentPageType => ItemDisplayFrame.SourcePageType; - - public ToolbarViewModel ToolbarViewModel { get; } = new ToolbarViewModel(); - - public ColumnShellPage() + public ColumnShellPage() : base(new CurrentInstanceViewModel(FolderLayoutModes.ColumnView)) { InitializeComponent(); - - InstanceViewModel = new CurrentInstanceViewModel(FolderLayoutModes.ColumnView); - InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired += FolderSettings_LayoutPreferencesUpdateRequired; - cancellationTokenSource = new CancellationTokenSource(); - FilesystemHelpers = new FilesystemHelpers(this, cancellationTokenSource.Token); - storageHistoryHelpers = new StorageHistoryHelpers(new StorageHistoryOperations(this, cancellationTokenSource.Token)); - - DisplayFilesystemConsentDialog(); - - var flowDirectionSetting = /* - TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK - Use your ResourceManager instance to create a ResourceContext as below. If you already have a ResourceManager instance, - replace the new instance created below with correct instance. - Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore - */new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; - - if (flowDirectionSetting == "RTL") - { - FlowDirection = FlowDirection.RightToLeft; - } - - //NavigationToolbar.PathControlDisplayText = "Home"; - //NavigationToolbar.CanGoBack = false; - //NavigationToolbar.CanGoForward = false; - //NavigationToolbar.SearchBox.QueryChanged += ColumnShellPage_QueryChanged; - //NavigationToolbar.SearchBox.QuerySubmitted += ColumnShellPage_QuerySubmitted; - //NavigationToolbar.SearchBox.SuggestionChosen += ColumnShellPage_SuggestionChosen; - - ToolbarViewModel.ToolbarPathItemInvoked += ColumnShellPage_NavigationRequested; - ToolbarViewModel.ToolbarFlyoutOpened += ColumnShellPage_ToolbarFlyoutOpened; - ToolbarViewModel.ToolbarPathItemLoaded += ColumnShellPage_ToolbarPathItemLoaded; - ToolbarViewModel.AddressBarTextEntered += ColumnShellPage_AddressBarTextEntered; - ToolbarViewModel.PathBoxItemDropped += ColumnShellPage_PathBoxItemDropped; - - /* - TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. - The tool has generated a custom back button in the MainWindow.xaml.cs file. - Feel free to edit its position, behavior and use the custom back button instead. - Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality - */ - ToolbarViewModel.BackRequested += ColumnShellPage_BackNavRequested; - ToolbarViewModel.UpRequested += ColumnShellPage_UpNavRequested; - ToolbarViewModel.RefreshRequested += ColumnShellPage_RefreshRequested; - ToolbarViewModel.ForwardRequested += ColumnShellPage_ForwardNavRequested; - ToolbarViewModel.EditModeEnabled += NavigationToolbar_EditModeEnabled; - ToolbarViewModel.ItemDraggedOverPathItem += ColumnShellPage_NavigationRequested; - ToolbarViewModel.PathBoxQuerySubmitted += NavigationToolbar_QuerySubmitted; - ToolbarViewModel.SearchBox.TextChanged += ColumnShellPage_TextChanged; - ToolbarViewModel.SearchBox.QuerySubmitted += ColumnShellPage_QuerySubmitted; - - ToolbarViewModel.InstanceViewModel = InstanceViewModel; - //NavToolbarViewModel.RefreshWidgetsRequested += refreshwid; - - InitToolbarCommands(); - - InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated += AppSettings_SortDirectionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated += AppSettings_SortOptionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated += AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - - PointerPressed += CoreWindow_PointerPressed; - - /* - - TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. - The tool has generated a custom back button in the MainWindow.xaml.cs file. - Feel free to edit its position, behavior and use the custom back button instead. - Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality - */ - //SystemNavigationManager.GetForCurrentView().BackRequested += ColumnShellPage_BackRequested; - - App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged; - - PreviewKeyDown += ColumnShellPage_PreviewKeyDown; - } - - /** - * Some keys are overriden by control built-in defaults (e.g. 'Space'). - * They must be handled here since they're not propagated to KeyboardAccelerator. - */ - private async void ColumnShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs args) - { - var ctrl = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shift = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); - var alt = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); - var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || - CurrentPageType == typeof(GridViewBrowser) || - CurrentPageType == typeof(ColumnViewBrowser) || - CurrentPageType == typeof(ColumnViewBase); - - switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.Key) - { - case (true, _, false, true, (VirtualKey)192): // ctrl + ` (accent key), open terminal - // Check if there is a folder selected, if not use the current directory. - string path = FilesystemViewModel.WorkingDirectory; - if (SlimContentPage?.SelectedItem?.PrimaryItemAttribute == StorageItemTypes.Folder) - { - path = SlimContentPage.SelectedItem.ItemPath; - } - - var terminalStartInfo = new ProcessStartInfo() - { - FileName = "wt.exe", - Arguments = $"-d {path}", - Verb = shift ? "runas" : "", - UseShellExecute = true - }; - DispatcherQueue.TryEnqueue(() => Process.Start(terminalStartInfo)); - - args.Handled = true; - break; - - case (false, false, false, true, VirtualKey.Space): // space, quick look - // handled in `CurrentPageType`::FileList_PreviewKeyDown - break; - - case (true, false, false, true, VirtualKey.Space): // ctrl + space, toggle media playback - if (App.PreviewPaneViewModel.PreviewPaneContent is UserControls.FilePreviews.MediaPreview mediaPreviewContent) - { - mediaPreviewContent.ViewModel.TogglePlayback(); - args.Handled = true; - } - break; - } - } - - private async void ColumnShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathItemLoadedEventArgs e) - { - await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, e.Item, this); - } - - private async void ColumnShellPage_ToolbarFlyoutOpened(object sender, ToolbarFlyoutOpenedEventArgs e) - { - await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, (e.OpenedFlyout.Target as FontIcon).DataContext as PathBoxItem, this); - } - - private void InitToolbarCommands() - { - ToolbarViewModel.SelectAllContentPageItemsCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.SelectAllItems()); - ToolbarViewModel.InvertContentPageSelctionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.InvertSelection()); - ToolbarViewModel.ClearContentPageSelectionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.ClearSelection()); - ToolbarViewModel.PasteItemsFromClipboardCommand = new RelayCommand(async () => await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this)); - ToolbarViewModel.OpenNewWindowCommand = new AsyncRelayCommand(NavigationHelpers.LaunchNewWindowAsync); - ToolbarViewModel.OpenNewPaneCommand = new RelayCommand(() => PaneHolder?.OpenPathInNewPane("Home")); - ToolbarViewModel.ClosePaneCommand = new RelayCommand(() => PaneHolder?.CloseActivePane()); - ToolbarViewModel.CreateNewFileCommand = new RelayCommand(x => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.File, x, this)); - ToolbarViewModel.CreateNewFolderCommand = new RelayCommand(() => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.Folder, null, this)); - ToolbarViewModel.CreateNewShortcutCommand = new RelayCommand(() => CreateNewShortcutFromDialog()); - ToolbarViewModel.CopyCommand = new RelayCommand(async () => await UIFilesystemHelpers.CopyItem(this)); - ToolbarViewModel.Rename = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RenameItemCommand.Execute(null)); - ToolbarViewModel.Share = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShareItemCommand.Execute(null)); - ToolbarViewModel.DeleteCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DeleteItemCommand.Execute(null)); - ToolbarViewModel.CutCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.CutItemCommand.Execute(null)); - ToolbarViewModel.EmptyRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.EmptyRecycleBinCommand.Execute(null)); - ToolbarViewModel.RestoreRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreRecycleBinCommand.Execute(null)); - ToolbarViewModel.RestoreSelectionRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreSelectionRecycleBinCommand.Execute(null)); - ToolbarViewModel.RunWithPowerShellCommand = new RelayCommand(async () => await Win32Helpers.InvokeWin32ComponentAsync("powershell", this, PathNormalization.NormalizePath(SlimContentPage?.SelectedItem.ItemPath))); - ToolbarViewModel.PropertiesCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShowPropertiesCommand.Execute(null)); - ToolbarViewModel.SetAsBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsDesktopBackgroundItemCommand.Execute(null)); - ToolbarViewModel.SetAsLockscreenBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsLockscreenBackgroundItemCommand.Execute(null)); - ToolbarViewModel.SetAsSlideshowCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsSlideshowItemCommand.Execute(null)); - ToolbarViewModel.ExtractCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveCommand.Execute(null)); - ToolbarViewModel.ExtractHereCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveHereCommand.Execute(null)); - ToolbarViewModel.ExtractToCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveToChildFolderCommand.Execute(null)); - ToolbarViewModel.InstallInfCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallInfDriver.Execute(null)); - ToolbarViewModel.RotateImageLeftCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.CanExecute(null) == true); - ToolbarViewModel.RotateImageRightCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.CanExecute(null) == true); - ToolbarViewModel.InstallFontCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallFontCommand.Execute(null)); - ToolbarViewModel.UpdateCommand = new AsyncRelayCommand(async () => await updateSettingsService.DownloadUpdates()); - } - - private void FolderSettings_LayoutPreferencesUpdateRequired(object sender, LayoutPreferenceEventArgs e) - { - } - - /* - * Ensure that the path bar gets updated for user interaction - * whenever the path changes. We will get the individual directories from - * the updated, most-current path and add them to the UI. - */ - - public void UpdatePathUIToWorkingDirectory(string newWorkingDir, string singleItemOverride = null) - { - if (string.IsNullOrWhiteSpace(singleItemOverride)) - { - var components = StorageFileExtensions.GetDirectoryPathComponents(newWorkingDir); - var lastCommonItemIndex = ToolbarViewModel.PathComponents - .Select((value, index) => new { value, index }) - .LastOrDefault(x => x.index < components.Count && x.value.Path == components[x.index].Path)?.index ?? 0; - while (ToolbarViewModel.PathComponents.Count > lastCommonItemIndex) - { - ToolbarViewModel.PathComponents.RemoveAt(lastCommonItemIndex); - } - foreach (var component in components.Skip(lastCommonItemIndex)) - { - ToolbarViewModel.PathComponents.Add(component); - } - } - else - { - ToolbarViewModel.PathComponents.Clear(); // Clear the path UI - ToolbarViewModel.IsSingleItemOverride = true; - ToolbarViewModel.PathComponents.Add(new PathBoxItem() { Path = null, Title = singleItemOverride }); - } - } - - private async void ColumnShellPage_TextChanged(ISearchBox sender, SearchBoxTextChangedEventArgs e) - { - if (e.Reason == SearchBoxTextChangeReason.UserInput) - { - if (!string.IsNullOrWhiteSpace(sender.Query)) - { - var search = new FolderSearch - { - Query = sender.Query, - Folder = FilesystemViewModel.WorkingDirectory, - MaxItemCount = 10, - SearchUnindexedItems = UserSettingsService.PreferencesSettingsService.SearchUnindexedItems - }; - sender.SetSuggestions((await search.SearchAsync()).Select(suggestion => new SuggestionModel(suggestion))); - } - else - { - sender.AddRecentQueries(); - } - } - } - - private async void ColumnShellPage_QuerySubmitted(ISearchBox sender, SearchBoxQuerySubmittedEventArgs e) - { - if (e.ChosenSuggestion is SuggestionModel item && !string.IsNullOrWhiteSpace(item.ItemPath)) - { - await NavigationHelpers.OpenPath(item.ItemPath, this); - } - else if (e.ChosenSuggestion is null && !string.IsNullOrWhiteSpace(sender.Query)) - { - SubmitSearch(sender.Query, UserSettingsService.PreferencesSettingsService.SearchUnindexedItems); - } - } - - private void ColumnShellPage_RefreshRequested(object sender, EventArgs e) - { - Refresh_Click(); - } - - private void ColumnShellPage_UpNavRequested(object sender, EventArgs e) - { - Up_Click(); - } - - private void ColumnShellPage_ForwardNavRequested(object sender, EventArgs e) - { - Forward_Click(); - } - - private void ColumnShellPage_BackNavRequested(object sender, EventArgs e) - { - Back_Click(); } protected override void OnNavigatedTo(NavigationEventArgs eventArgs) @@ -406,109 +41,10 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) FilesystemViewModel_DirectoryInfoUpdated(this, EventArgs.Empty); } - private void AppSettings_SortDirectionPreferenceUpdated(object sender, SortDirection e) - { - FilesystemViewModel?.UpdateSortDirectionStatus(); - } - - private void AppSettings_SortOptionPreferenceUpdated(object sender, SortOption e) - { - FilesystemViewModel?.UpdateSortOptionStatus(); - } - - private void AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated(object sender, bool e) - { - FilesystemViewModel?.UpdateSortDirectoriesAlongsideFiles(); - } - - private void CoreWindow_PointerPressed(object sender, PointerRoutedEventArgs args) - { - if (IsCurrentInstance) - { - if (args.GetCurrentPoint(this).Properties.IsXButton1Pressed) - { - Back_Click(); - } - else if (args.GetCurrentPoint(this).Properties.IsXButton2Pressed) - { - Forward_Click(); - } - } - } - - private async void ColumnShellPage_PathBoxItemDropped(object sender, PathBoxItemDroppedEventArgs e) - { - await FilesystemHelpers.PerformOperationTypeAsync(e.AcceptedOperation, e.Package, e.Path, false, true); - e.SignalEvent?.Set(); - } - - private void ColumnShellPage_AddressBarTextEntered(object sender, AddressBarTextEnteredEventArgs e) - { - ToolbarViewModel.SetAddressBarSuggestions(e.AddressBarTextField, this); - } - - private void ColumnShellPage_NavigationRequested(object sender, PathNavigationEventArgs e) - { - this.FindAscendant().SetSelectedPathOrNavigate(e); - } - - private async void NavigationToolbar_QuerySubmitted(object sender, ToolbarQuerySubmittedEventArgs e) - { - await ToolbarViewModel.CheckPathInput(e.QueryText, ToolbarViewModel.PathComponents[ToolbarViewModel.PathComponents.Count - 1].Path, this); - } - - private void NavigationToolbar_EditModeEnabled(object sender, EventArgs e) - { - ToolbarViewModel.ManualEntryBoxLoaded = true; - ToolbarViewModel.ClickablePathLoaded = false; - ToolbarViewModel.PathText = string.IsNullOrEmpty(FilesystemViewModel?.WorkingDirectory) - ? CommonPaths.HomePath - : FilesystemViewModel.WorkingDirectory; - } - - private void DrivesManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == "ShowUserConsentOnInit") - { - DisplayFilesystemConsentDialog(); - } - } - - private async Task GetContentOrNullAsync() - { - BaseLayout FrameContent = null; - await DispatcherQueue.EnqueueAsync(() => - { - FrameContent = ItemDisplayFrame.Content as BaseLayout; - }); - return FrameContent; - } - - // WINUI3 - private static ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - } - return contentDialog; - } - - private async void DisplayFilesystemConsentDialog() - { - if (App.DrivesManager?.ShowUserConsentOnInit ?? false) - { - App.DrivesManager.ShowUserConsentOnInit = false; - await DispatcherQueue.EnqueueAsync(async () => - { - DynamicDialog dialog = DynamicDialogFactory.GetFor_ConsentDialog(); - await SetContentDialogRoot(dialog).ShowAsync(ContentDialogPlacement.Popup); - }); - } - } + protected override void ShellPage_NavigationRequested(object sender, PathNavigationEventArgs e) + => this.FindAscendant().SetSelectedPathOrNavigate(e); private ColumnParam columnParams; - public ColumnParam ColumnParams { get => columnParams; @@ -518,14 +54,12 @@ public ColumnParam ColumnParams { columnParams = value; if (IsLoaded) - { OnNavigationParamsChanged(); - } } } } - private void OnNavigationParamsChanged() + protected override void OnNavigationParamsChanged() { ItemDisplayFrame.Navigate(typeof(ColumnViewBase), new NavigationArguments() @@ -539,49 +73,7 @@ private void OnNavigationParamsChanged() }); } - public static readonly DependencyProperty NavParamsProperty = - DependencyProperty.Register("NavParams", typeof(NavigationParams), typeof(ColumnShellPage), new PropertyMetadata(null)); - - private TabItemArguments tabItemArguments; - - public TabItemArguments TabItemArguments - { - get => tabItemArguments; - set - { - if (tabItemArguments != value) - { - tabItemArguments = value; - ContentChanged?.Invoke(this, value); - } - } - } - - private IPaneHolder paneHolder; - - public IPaneHolder PaneHolder - { - get => paneHolder; - set - { - if (value != paneHolder) - { - paneHolder = value; - NotifyPropertyChanged(nameof(PaneHolder)); - } - } - } - - public event PropertyChangedEventHandler PropertyChanged; - - public event EventHandler ContentChanged; - - private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - - private void Page_Loaded(object sender, RoutedEventArgs e) + protected override void Page_Loaded(object sender, RoutedEventArgs e) { FilesystemViewModel = new ItemViewModel(InstanceViewModel?.FolderSettings); FilesystemViewModel.WorkingDirectoryModified += ViewModel_WorkingDirectoryModified; @@ -589,42 +81,14 @@ private void Page_Loaded(object sender, RoutedEventArgs e) FilesystemViewModel.DirectoryInfoUpdated += FilesystemViewModel_DirectoryInfoUpdated; FilesystemViewModel.PageTypeUpdated += FilesystemViewModel_PageTypeUpdated; FilesystemViewModel.OnSelectionRequestedEvent += FilesystemViewModel_OnSelectionRequestedEvent; - OnNavigationParamsChanged(); - Loaded -= Page_Loaded; + base.Page_Loaded(sender, e); } - private void FilesystemViewModel_PageTypeUpdated(object sender, PageTypeUpdatedEventArgs e) - { - InstanceViewModel.IsPageTypeCloudDrive = e.IsTypeCloudDrive; - } - - private void FilesystemViewModel_OnSelectionRequestedEvent(object sender, List e) - { - // set focus since selection might occur before the UI finishes updating - ContentPage.ItemManipulationModel.FocusFileList(); - ContentPage.ItemManipulationModel.SetSelectedItems(e); - } - - private void FilesystemViewModel_DirectoryInfoUpdated(object sender, EventArgs e) - { - if (ContentPage is null) - return; - - var directoryItemCountLocalization = (FilesystemViewModel.FilesAndFolders.Count == 1) - ? "ItemCount/Text".GetLocalizedResource() - : "ItemsCount/Text".GetLocalizedResource(); - - ContentPage.DirectoryPropertiesViewModel.DirectoryItemCount = $"{FilesystemViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}"; - ContentPage.UpdateSelectionSize(); - } - - private void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e) + protected override void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e) { string value = e.Path; if (!string.IsNullOrWhiteSpace(value)) - { UpdatePathUIToWorkingDirectory(value); - } } private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e) @@ -651,44 +115,44 @@ private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args) { args.Handled = true; - var ctrl = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Control); - var shift = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift); - var alt = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu); var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || CurrentPageType == typeof(ColumnViewBase); + // F2, rename + if (args.KeyboardAccelerator.Key is VirtualKey.F2 + && tabInstance + && ContentPage.IsItemSelected) + { + ContentPage.ItemManipulationModel.StartRenameItem(); + return; + } + + var ctrl = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Control); + var shift = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift); + var alt = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu); + switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.KeyboardAccelerator.Key) { case (true, false, false, true, VirtualKey.E): // ctrl + e, extract - { - if (ToolbarViewModel.CanExtract) - { - ToolbarViewModel.ExtractCommand.Execute(null); - } - break; - } + if (ToolbarViewModel.CanExtract) + ToolbarViewModel.ExtractCommand.Execute(null); + break; case (true, false, false, true, VirtualKey.Z): // ctrl + z, undo if (!InstanceViewModel.IsPageTypeSearchResults) - { await storageHistoryHelpers.TryUndo(); - } break; case (true, false, false, true, VirtualKey.Y): // ctrl + y, redo if (!InstanceViewModel.IsPageTypeSearchResults) - { await storageHistoryHelpers.TryRedo(); - } break; case (true, true, false, true, VirtualKey.C): - { - SlimContentPage?.CommandsViewModel.CopyPathOfSelectedItemCommand.Execute(null); - break; - } + SlimContentPage?.CommandsViewModel.CopyPathOfSelectedItemCommand.Execute(null); + break; case (false, false, false, true, VirtualKey.F3): //f3 case (true, false, false, true, VirtualKey.F): // ctrl + f @@ -716,41 +180,29 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo var items = SlimContentPage.SelectedItems.ToList().Select((item) => StorageHelpers.FromPathAndType( item.ItemPath, item.PrimaryItemAttribute == StorageItemTypes.File ? FilesystemItemType.File : FilesystemItemType.Directory)); - await FilesystemHelpers.DeleteItemsAsync(items, UserSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, true, true); + await FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, true, true); } - break; case (true, false, false, true, VirtualKey.C): // ctrl + c, copy if (!ToolbarViewModel.IsEditModeEnabled && !ContentPage.IsRenamingItem) - { await UIFilesystemHelpers.CopyItem(this); - } break; case (true, false, false, true, VirtualKey.V): // ctrl + v, paste if (!ToolbarViewModel.IsEditModeEnabled && !ContentPage.IsRenamingItem && !InstanceViewModel.IsPageTypeSearchResults && !ToolbarViewModel.SearchHasFocus) - { await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this); - } - break; case (true, false, false, true, VirtualKey.X): // ctrl + x, cut if (!ToolbarViewModel.IsEditModeEnabled && !ContentPage.IsRenamingItem) - { UIFilesystemHelpers.CutItem(this); - } - break; case (true, false, false, true, VirtualKey.A): // ctrl + a, select all if (!ToolbarViewModel.IsEditModeEnabled && !ContentPage.IsRenamingItem) - { SlimContentPage.ItemManipulationModel.SelectAllItems(); - } - break; case (true, false, false, true, VirtualKey.D): // ctrl + d, delete item @@ -760,9 +212,8 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo var items = SlimContentPage.SelectedItems.ToList().Select((item) => StorageHelpers.FromPathAndType( item.ItemPath, item.PrimaryItemAttribute == StorageItemTypes.File ? FilesystemItemType.File : FilesystemItemType.Directory)); - await FilesystemHelpers.DeleteItemsAsync(items, UserSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, false, true); + await FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, false, true); } - break; case (true, false, false, true, VirtualKey.P): // ctrl + p, toggle preview pane @@ -771,9 +222,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo case (true, false, false, true, VirtualKey.R): // ctrl + r, refresh if (ToolbarViewModel.CanRefresh) - { Refresh_Click(); - } break; case (false, false, true, true, VirtualKey.D): // alt + d, select address bar (english) @@ -786,252 +235,44 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo break; case (true, false, false, true, VirtualKey.H): // ctrl + h, toggle hidden folder visibility - UserSettingsService.FoldersSettingsService.ShowHiddenItems ^= true; // flip bool + userSettingsService.FoldersSettingsService.ShowHiddenItems ^= true; // flip bool break; case (false, false, false, _, VirtualKey.F1): // F1, open Files wiki await Launcher.LaunchUriAsync(new Uri(Constants.GitHub.DocumentationUrl)); break; } - - switch (args.KeyboardAccelerator.Key) - { - case VirtualKey.F2: //F2, rename - if (CurrentPageType == typeof(DetailsLayoutBrowser) - || CurrentPageType == typeof(GridViewBrowser) - || CurrentPageType == typeof(ColumnViewBrowser) - || CurrentPageType == typeof(ColumnViewBase)) - { - if (ContentPage.IsItemSelected) - { - ContentPage.ItemManipulationModel.StartRenameItem(); - } - } - break; - } } - public async void Refresh_Click() - { - if (InstanceViewModel.IsPageTypeSearchResults) - { - ToolbarViewModel.CanRefresh = false; - var searchInstance = new FolderSearch - { - Query = InstanceViewModel.CurrentSearchQuery, - Folder = FilesystemViewModel.WorkingDirectory, - ThumbnailSize = InstanceViewModel.FolderSettings.GetIconSize(), - SearchUnindexedItems = InstanceViewModel.SearchedUnindexedItems - }; - await FilesystemViewModel.SearchAsync(searchInstance); - } - else if (CurrentPageType != typeof(WidgetsPage)) - { - ToolbarViewModel.CanRefresh = false; - FilesystemViewModel?.RefreshItems(null); - } - } - - public void Back_Click() + public override void Back_Click() { ToolbarViewModel.CanGoBack = false; if (ItemDisplayFrame.CanGoBack) - { - var previousPageContent = ItemDisplayFrame.BackStack[ItemDisplayFrame.BackStack.Count - 1]; - var previousPageNavPath = previousPageContent.Parameter as NavigationArguments; - previousPageNavPath.IsLayoutSwitch = false; - if (previousPageContent.SourcePageType != typeof(WidgetsPage)) - { - // Update layout type - InstanceViewModel.FolderSettings.GetLayoutType(previousPageNavPath.IsSearchResultPage ? previousPageNavPath.SearchPathParam : previousPageNavPath.NavPathParam); - } - SelectSidebarItemFromPath(previousPageContent.SourcePageType); - - if (previousPageContent.SourcePageType == typeof(WidgetsPage)) - { - ItemDisplayFrame.GoBack(new EntranceNavigationTransitionInfo()); - } - else - { - ItemDisplayFrame.GoBack(); - } - } + base.Back_Click(); else - { this.FindAscendant().NavigateBack(); - } } - public void Forward_Click() + public override void Forward_Click() { ToolbarViewModel.CanGoForward = false; if (ItemDisplayFrame.CanGoForward) - { - var incomingPageContent = ItemDisplayFrame.ForwardStack[ItemDisplayFrame.ForwardStack.Count - 1]; - var incomingPageNavPath = incomingPageContent.Parameter as NavigationArguments; - incomingPageNavPath.IsLayoutSwitch = false; - if (incomingPageContent.SourcePageType != typeof(WidgetsPage)) - { - // Update layout type - InstanceViewModel.FolderSettings.GetLayoutType(incomingPageNavPath.IsSearchResultPage ? incomingPageNavPath.SearchPathParam : incomingPageNavPath.NavPathParam); - } - SelectSidebarItemFromPath(incomingPageContent.SourcePageType); - ItemDisplayFrame.GoForward(); - } + base.Forward_Click(); else - { this.FindAscendant().NavigateForward(); - } } - public void Up_Click() + public override void Up_Click() { this.FindAscendant().NavigateUp(); } - private void SelectSidebarItemFromPath(Type incomingSourcePageType = null) - { - if (incomingSourcePageType == typeof(WidgetsPage) && incomingSourcePageType is not null) - { - ToolbarViewModel.PathControlDisplayText = "Home"; - } - } - - public void Dispose() - { - PreviewKeyDown -= ColumnShellPage_PreviewKeyDown; - PointerPressed -= CoreWindow_PointerPressed; - //SystemNavigationManager.GetForCurrentView().BackRequested -= ColumnShellPage_BackRequested; //WINUI3 - App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged; - - ToolbarViewModel.ToolbarPathItemInvoked -= ColumnShellPage_NavigationRequested; - ToolbarViewModel.ToolbarFlyoutOpened -= ColumnShellPage_ToolbarFlyoutOpened; - ToolbarViewModel.ToolbarPathItemLoaded -= ColumnShellPage_ToolbarPathItemLoaded; - ToolbarViewModel.AddressBarTextEntered -= ColumnShellPage_AddressBarTextEntered; - ToolbarViewModel.PathBoxItemDropped -= ColumnShellPage_PathBoxItemDropped; - ToolbarViewModel.BackRequested -= ColumnShellPage_BackNavRequested; - ToolbarViewModel.UpRequested -= ColumnShellPage_UpNavRequested; - ToolbarViewModel.RefreshRequested -= ColumnShellPage_RefreshRequested; - ToolbarViewModel.ForwardRequested -= ColumnShellPage_ForwardNavRequested; - ToolbarViewModel.EditModeEnabled -= NavigationToolbar_EditModeEnabled; - ToolbarViewModel.ItemDraggedOverPathItem -= ColumnShellPage_NavigationRequested; - ToolbarViewModel.PathBoxQuerySubmitted -= NavigationToolbar_QuerySubmitted; - - ToolbarViewModel.SearchBox.TextChanged -= ColumnShellPage_TextChanged; - ToolbarViewModel.SearchBox.QuerySubmitted -= ColumnShellPage_QuerySubmitted; - - InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired -= FolderSettings_LayoutPreferencesUpdateRequired; - InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated -= AppSettings_SortDirectionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated -= AppSettings_SortOptionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated -= AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - - if (FilesystemViewModel is not null) // Prevent weird case of this being null when many tabs are opened/closed quickly - { - FilesystemViewModel.WorkingDirectoryModified -= ViewModel_WorkingDirectoryModified; - FilesystemViewModel.ItemLoadStatusChanged -= FilesystemViewModel_ItemLoadStatusChanged; - FilesystemViewModel.DirectoryInfoUpdated -= FilesystemViewModel_DirectoryInfoUpdated; - FilesystemViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated; - FilesystemViewModel.OnSelectionRequestedEvent -= FilesystemViewModel_OnSelectionRequestedEvent; - FilesystemViewModel.Dispose(); - } - - if (ItemDisplayFrame.Content is IDisposable disposableContent) - { - disposableContent?.Dispose(); - } - } - - private void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoadStatusChangedEventArgs e) - { - switch (e.Status) - { - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Starting: - ToolbarViewModel.CanRefresh = false; - SetLoadingIndicatorForTabs(true); - break; - - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.InProgress: - var browser = this.FindAscendant(); - ToolbarViewModel.CanGoBack = ItemDisplayFrame.CanGoBack || browser.ParentShellPageInstance.CanNavigateBackward; - ToolbarViewModel.CanGoForward = ItemDisplayFrame.CanGoForward || browser.ParentShellPageInstance.CanNavigateForward; - SetLoadingIndicatorForTabs(true); - break; - - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Complete: - SetLoadingIndicatorForTabs(false); - ToolbarViewModel.CanRefresh = true; - // Select previous directory - if (!string.IsNullOrWhiteSpace(e.PreviousDirectory)) - { - if (e.PreviousDirectory.Contains(e.Path, StringComparison.Ordinal) && !e.PreviousDirectory.Contains(CommonPaths.RecycleBinPath, StringComparison.Ordinal)) - { - // Remove the WorkingDir from previous dir - e.PreviousDirectory = e.PreviousDirectory.Replace(e.Path, string.Empty, StringComparison.Ordinal); - - // Get previous dir name - if (e.PreviousDirectory.StartsWith('\\')) - { - e.PreviousDirectory = e.PreviousDirectory.Remove(0, 1); - } - if (e.PreviousDirectory.Contains('\\')) - { - e.PreviousDirectory = e.PreviousDirectory.Split('\\')[0]; - } - - // Get the first folder and combine it with WorkingDir - string folderToSelect = string.Format("{0}\\{1}", e.Path, e.PreviousDirectory); - - // Make sure we don't get double \\ in the e.Path - folderToSelect = folderToSelect.Replace("\\\\", "\\", StringComparison.Ordinal); - - if (folderToSelect.EndsWith('\\')) - { - folderToSelect = folderToSelect.Remove(folderToSelect.Length - 1, 1); - } - - ListedItem itemToSelect = FilesystemViewModel.FilesAndFolders.Where((item) => item.ItemPath == folderToSelect).FirstOrDefault(); - - if (itemToSelect is not null && ContentPage is not null) - { - ContentPage.ItemManipulationModel.SetSelectedItem(itemToSelect); - ContentPage.ItemManipulationModel.ScrollIntoView(itemToSelect); - } - } - } - break; - } - } - - private void SetLoadingIndicatorForTabs(bool isLoading) - { - var multitaskingControls = ((App.Window.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; - - foreach (var x in multitaskingControls) - { - x.SetLoadingIndicatorStatus(x.Items.FirstOrDefault(x => x.Control.TabItemContent == PaneHolder), isLoading); - } - } - - public Task TabItemDragOver(object sender, DragEventArgs e) => SlimContentPage?.CommandsViewModel.CommandsModel.DragOver(e); - - public Task TabItemDrop(object sender, DragEventArgs e) => SlimContentPage?.CommandsViewModel.CommandsModel.Drop(e); - - public void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs) - { - NavigateToPath(navArgs.NavPathParam, sourcePageType, navArgs); - } - - public void NavigateToPath(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null) + public override void NavigateToPath(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null) { this.FindAscendant().SetSelectedPathOrNavigate(navigationPath, sourcePageType, navArgs); } - public void NavigateToPath(string navigationPath, NavigationArguments navArgs = null) - { - NavigateToPath(navigationPath, FolderSettings.GetLayoutType(navigationPath), navArgs); - } - - public void NavigateHome() + public override void NavigateHome() { throw new NotImplementedException("Can't show Home page in Column View"); } diff --git a/src/Files.App/Views/ModernShellPage.xaml b/src/Files.App/Views/ModernShellPage.xaml index c9233d9614ab..10676ddee92a 100644 --- a/src/Files.App/Views/ModernShellPage.xaml +++ b/src/Files.App/Views/ModernShellPage.xaml @@ -1,23 +1,24 @@ - - + - + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Files.App/Views/ModernShellPage.xaml.cs b/src/Files.App/Views/ModernShellPage.xaml.cs index e6bf88aab409..d711073395d5 100644 --- a/src/Files.App/Views/ModernShellPage.xaml.cs +++ b/src/Files.App/Views/ModernShellPage.xaml.cs @@ -1,120 +1,33 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using CommunityToolkit.Mvvm.Input; -using CommunityToolkit.WinUI; -using Files.App.DataModels; -using Files.App.Dialogs; using Files.App.EventArguments; using Files.App.Extensions; using Files.App.Filesystem; -using Files.App.Filesystem.FilesystemHistory; -using Files.App.Filesystem.Search; using Files.App.Helpers; using Files.App.UserControls; using Files.App.UserControls.MultitaskingControl; using Files.App.ViewModels; using Files.App.Views.LayoutModes; using Files.Backend.Enums; -using Files.Backend.Services; -using Files.Backend.Services.Settings; using Files.Backend.ViewModels.Dialogs.AddItemDialog; -using Files.Shared; -using Files.Shared.Enums; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; using Windows.Storage; using Windows.System; -using Windows.UI.Core; -using SortDirection = Files.Shared.Enums.SortDirection; namespace Files.App.Views { - public sealed partial class ModernShellPage : Page, IShellPage, INotifyPropertyChanged + public sealed partial class ModernShellPage : BaseShellPage { - private readonly StorageHistoryHelpers storageHistoryHelpers; - public IBaseLayout SlimContentPage => ContentPage; - public IFilesystemHelpers FilesystemHelpers { get; private set; } - private readonly CancellationTokenSource cancellationTokenSource; - public bool CanNavigateBackward => ItemDisplayFrame.CanGoBack; - public bool CanNavigateForward => ItemDisplayFrame.CanGoForward; - public FolderSettingsViewModel FolderSettings => InstanceViewModel?.FolderSettings; - public AppModel AppModel => App.AppModel; + public override bool CanNavigateBackward => ItemDisplayFrame.CanGoBack; + public override bool CanNavigateForward => ItemDisplayFrame.CanGoForward; - private readonly IDialogService dialogService = Ioc.Default.GetRequiredService(); - - private IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetRequiredService(); - - private readonly IUpdateService updateSettingsService = Ioc.Default.GetRequiredService(); - - private bool isCurrentInstance = false; - public bool IsCurrentInstance - { - get => isCurrentInstance; - set - { - if (isCurrentInstance != value) - { - isCurrentInstance = value; - if (isCurrentInstance) - ContentPage?.ItemManipulationModel.FocusFileList(); - else - ToolbarViewModel.IsEditModeEnabled = false; - NotifyPropertyChanged(nameof(IsCurrentInstance)); - } - } - } - - public bool IsColumnView => SlimContentPage is ColumnViewBrowser; - - public ItemViewModel FilesystemViewModel { get; private set; } - public CurrentInstanceViewModel InstanceViewModel { get; } - - private BaseLayout contentPage; - public BaseLayout ContentPage - { - get => contentPage; - set - { - if (value != contentPage) - { - contentPage = value; - NotifyPropertyChanged(nameof(ContentPage)); - NotifyPropertyChanged(nameof(SlimContentPage)); - } - } - } - - private bool isPageMainPane; - public bool IsPageMainPane - { - get => isPageMainPane; - set - { - if (value != isPageMainPane) - { - isPageMainPane = value; - NotifyPropertyChanged(nameof(IsPageMainPane)); - } - } - } - - public SolidColorBrush CurrentInstanceBorderBrush - { - get { return (SolidColorBrush)GetValue(CurrentInstanceBorderBrushProperty); } - set { SetValue(CurrentInstanceBorderBrushProperty, value); } - } + protected override Frame ItemDisplay => ItemDisplayFrame; public Thickness CurrentInstanceBorderThickness { @@ -126,23 +39,10 @@ public Thickness CurrentInstanceBorderThickness public static readonly DependencyProperty CurrentInstanceBorderThicknessProperty = DependencyProperty.Register("CurrentInstanceBorderThickness", typeof(Thickness), typeof(ModernShellPage), new PropertyMetadata(null)); - public static readonly DependencyProperty CurrentInstanceBorderBrushProperty = - DependencyProperty.Register("CurrentInstanceBorderBrush", typeof(SolidColorBrush), typeof(ModernShellPage), new PropertyMetadata(null)); - - public Type CurrentPageType => ItemDisplayFrame.SourcePageType; - - public ToolbarViewModel ToolbarViewModel { get; } = new ToolbarViewModel(); - - public ModernShellPage() + public ModernShellPage() : base(new CurrentInstanceViewModel()) { InitializeComponent(); - InstanceViewModel = new CurrentInstanceViewModel(); - InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired += FolderSettings_LayoutPreferencesUpdateRequired; - cancellationTokenSource = new CancellationTokenSource(); - FilesystemHelpers = new FilesystemHelpers(this, cancellationTokenSource.Token); - storageHistoryHelpers = new StorageHistoryHelpers(new StorageHistoryOperations(this, cancellationTokenSource.Token)); - FilesystemViewModel = new ItemViewModel(InstanceViewModel.FolderSettings); FilesystemViewModel.WorkingDirectoryModified += ViewModel_WorkingDirectoryModified; FilesystemViewModel.ItemLoadStatusChanged += FilesystemViewModel_ItemLoadStatusChanged; @@ -150,137 +50,9 @@ public ModernShellPage() FilesystemViewModel.PageTypeUpdated += FilesystemViewModel_PageTypeUpdated; FilesystemViewModel.OnSelectionRequestedEvent += FilesystemViewModel_OnSelectionRequestedEvent; - ToolbarViewModel.SearchBox.TextChanged += ModernShellPage_TextChanged; - ToolbarViewModel.SearchBox.QuerySubmitted += ModernShellPage_QuerySubmitted; - ToolbarViewModel.InstanceViewModel = InstanceViewModel; - InitToolbarCommands(); - - DisplayFilesystemConsentDialog(); - - /*TODO ResourceContext.GetForCurrentView and ResourceContext.GetForViewIndependentUse do not exist in Windows App SDK - Use your ResourceManager instance to create a ResourceContext as below.If you already have a ResourceManager instance, - replace the new instance created below with correct instance. - Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/mrtcore - */ - var flowDirectionSetting = new Microsoft.Windows.ApplicationModel.Resources.ResourceManager().CreateResourceContext().QualifierValues["LayoutDirection"]; - - if (flowDirectionSetting == "RTL") - FlowDirection = FlowDirection.RightToLeft; - - ToolbarViewModel.PathControlDisplayText = "Home"; - - ToolbarViewModel.ToolbarPathItemInvoked += ModernShellPage_NavigationRequested; - ToolbarViewModel.ToolbarFlyoutOpened += ModernShellPage_ToolbarFlyoutOpened; - ToolbarViewModel.ToolbarPathItemLoaded += ModernShellPage_ToolbarPathItemLoaded; - ToolbarViewModel.AddressBarTextEntered += ModernShellPage_AddressBarTextEntered; - ToolbarViewModel.PathBoxItemDropped += ModernShellPage_PathBoxItemDropped; - - ToolbarViewModel.BackRequested += ModernShellPage_BackNavRequested; - ToolbarViewModel.UpRequested += ModernShellPage_UpNavRequested; - ToolbarViewModel.RefreshRequested += ModernShellPage_RefreshRequested; - ToolbarViewModel.ForwardRequested += ModernShellPage_ForwardNavRequested; - ToolbarViewModel.EditModeEnabled += NavigationToolbar_EditModeEnabled; - ToolbarViewModel.ItemDraggedOverPathItem += ModernShellPage_NavigationRequested; - ToolbarViewModel.PathBoxQuerySubmitted += NavigationToolbar_QuerySubmitted; - ToolbarViewModel.RefreshWidgetsRequested += ModernShellPage_RefreshWidgetsRequested; - - InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated += AppSettings_SortDirectionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated += AppSettings_SortOptionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated += AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - - PointerPressed += CoreWindow_PointerPressed; - - /* - TODO UA307 Default back button in the title bar does not exist in WinUI3 apps. - The tool has generated a custom back button in the MainWindow.xaml.cs file. - Feel free to edit its position, behavior and use the custom back button instead. - Read: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/case-study-1#restoring-back-button-functionality - */ - //SystemNavigationManager.GetForCurrentView().BackRequested += ModernShellPage_BackRequested; - - App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged; - - PreviewKeyDown += ModernShellPage_PreviewKeyDown; - } - - /** - * Some keys are overriden by control built-in defaults (e.g. 'Space'). - * They must be handled here since they're not propagated to KeyboardAccelerator. - */ - private async void ModernShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs args) - { - var ctrl = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); - var shift = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down); - var alt = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down); - var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || - CurrentPageType == typeof(GridViewBrowser); - - switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.Key) - { - case (true, _, false, true, (VirtualKey)192): // ctrl + ` (accent key), open terminal - // Check if there is a folder selected, if not use the current directory. - string path = FilesystemViewModel.WorkingDirectory; - if (SlimContentPage?.SelectedItem?.PrimaryItemAttribute == StorageItemTypes.Folder) - path = SlimContentPage.SelectedItem.ItemPath; - - var terminalStartInfo = new ProcessStartInfo() - { - FileName = "wt.exe", - Arguments = $"-d {path}", - Verb = shift ? "runas" : "", - UseShellExecute = true - }; - DispatcherQueue.TryEnqueue(() => Process.Start(terminalStartInfo)); + ToolbarViewModel.PathControlDisplayText = "Home".GetLocalizedResource(); - break; - - case (false, false, false, true, VirtualKey.Space): // space, quick look - // handled in `CurrentPageType`::FileList_PreviewKeyDown - break; - - case (true, false, false, true, VirtualKey.Space): // ctrl + space, toggle media playback - if (App.PreviewPaneViewModel.PreviewPaneContent is UserControls.FilePreviews.MediaPreview mediaPreviewContent) - { - mediaPreviewContent.ViewModel.TogglePlayback(); - args.Handled = true; - } - break; - } - } - - private void InitToolbarCommands() - { - ToolbarViewModel.SelectAllContentPageItemsCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.SelectAllItems()); - ToolbarViewModel.InvertContentPageSelctionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.InvertSelection()); - ToolbarViewModel.ClearContentPageSelectionCommand = new RelayCommand(() => SlimContentPage?.ItemManipulationModel.ClearSelection()); - ToolbarViewModel.PasteItemsFromClipboardCommand = new RelayCommand(async () => await UIFilesystemHelpers.PasteItemAsync(FilesystemViewModel.WorkingDirectory, this)); - ToolbarViewModel.OpenNewWindowCommand = new AsyncRelayCommand(NavigationHelpers.LaunchNewWindowAsync); - ToolbarViewModel.OpenNewPaneCommand = new RelayCommand(() => PaneHolder?.OpenPathInNewPane("Home")); - ToolbarViewModel.ClosePaneCommand = new RelayCommand(() => PaneHolder?.CloseActivePane()); - ToolbarViewModel.CreateNewFileCommand = new RelayCommand(x => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.File, x, this)); - ToolbarViewModel.CreateNewFolderCommand = new RelayCommand(() => UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.Folder, null, this)); - ToolbarViewModel.CreateNewShortcutCommand = new RelayCommand(() => CreateNewShortcutFromDialog()); - ToolbarViewModel.CopyCommand = new RelayCommand(async () => await UIFilesystemHelpers.CopyItem(this)); - ToolbarViewModel.Rename = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RenameItemCommand.Execute(null)); - ToolbarViewModel.Share = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShareItemCommand.Execute(null)); - ToolbarViewModel.DeleteCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DeleteItemCommand.Execute(null)); - ToolbarViewModel.CutCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.CutItemCommand.Execute(null)); - ToolbarViewModel.EmptyRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.EmptyRecycleBinCommand.Execute(null)); - ToolbarViewModel.RestoreRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreRecycleBinCommand.Execute(null)); - ToolbarViewModel.RestoreSelectionRecycleBinCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RestoreSelectionRecycleBinCommand.Execute(null)); - ToolbarViewModel.RunWithPowerShellCommand = new RelayCommand(async () => await Win32Helpers.InvokeWin32ComponentAsync("powershell", this, PathNormalization.NormalizePath(SlimContentPage?.SelectedItem.ItemPath))); - ToolbarViewModel.PropertiesCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.ShowPropertiesCommand.Execute(null)); - ToolbarViewModel.SetAsBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsDesktopBackgroundItemCommand.Execute(null)); - ToolbarViewModel.SetAsLockscreenBackgroundCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsLockscreenBackgroundItemCommand.Execute(null)); - ToolbarViewModel.SetAsSlideshowCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.SetAsSlideshowItemCommand.Execute(null)); - ToolbarViewModel.ExtractCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveCommand.Execute(null)); - ToolbarViewModel.ExtractHereCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveHereCommand.Execute(null)); - ToolbarViewModel.ExtractToCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.DecompressArchiveToChildFolderCommand.Execute(null)); - ToolbarViewModel.InstallInfCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallInfDriver.Execute(null)); - ToolbarViewModel.RotateImageLeftCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageLeftCommand.CanExecute(null) == true); - ToolbarViewModel.RotateImageRightCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.Execute(null), () => SlimContentPage?.CommandsViewModel.RotateImageRightCommand.CanExecute(null) == true); - ToolbarViewModel.InstallFontCommand = new RelayCommand(() => SlimContentPage?.CommandsViewModel.InstallFontCommand.Execute(null)); - ToolbarViewModel.UpdateCommand = new AsyncRelayCommand(async () => await updateSettingsService.DownloadUpdates()); + ToolbarViewModel.RefreshWidgetsRequested += ModernShellPage_RefreshWidgetsRequested; } private void ModernShellPage_RefreshWidgetsRequested(object sender, EventArgs e) @@ -289,7 +61,7 @@ private void ModernShellPage_RefreshWidgetsRequested(object sender, EventArgs e) currentPage.RefreshWidgetList(); } - private void FolderSettings_LayoutPreferencesUpdateRequired(object sender, LayoutPreferenceEventArgs e) + protected override void FolderSettings_LayoutPreferencesUpdateRequired(object sender, LayoutPreferenceEventArgs e) { if (FilesystemViewModel is null) return; @@ -299,100 +71,6 @@ private void FolderSettings_LayoutPreferencesUpdateRequired(object sender, Layou AdaptiveLayoutHelpers.ApplyAdaptativeLayout(InstanceViewModel.FolderSettings, FilesystemViewModel.WorkingDirectory, FilesystemViewModel.FilesAndFolders); } - /* - * Ensure that the path bar gets updated for user interaction - * whenever the path changes. We will get the individual directories from - * the updated, most-current path and add them to the UI. - */ - public void UpdatePathUIToWorkingDirectory(string newWorkingDir, string singleItemOverride = null) - { - if (string.IsNullOrWhiteSpace(singleItemOverride)) - { - var components = StorageFileExtensions.GetDirectoryPathComponents(newWorkingDir); - var lastCommonItemIndex = ToolbarViewModel.PathComponents - .Select((value, index) => new { value, index }) - .LastOrDefault(x => x.index < components.Count && x.value.Path == components[x.index].Path)?.index ?? 0; - while (ToolbarViewModel.PathComponents.Count > lastCommonItemIndex) - { - ToolbarViewModel.PathComponents.RemoveAt(lastCommonItemIndex); - } - foreach (var component in components.Skip(lastCommonItemIndex)) - { - ToolbarViewModel.PathComponents.Add(component); - } - } - else - { - ToolbarViewModel.PathComponents.Clear(); // Clear the path UI - ToolbarViewModel.PathComponents.Add(new PathBoxItem() { Path = null, Title = singleItemOverride }); - } - } - - private async void ModernShellPage_TextChanged(ISearchBox sender, SearchBoxTextChangedEventArgs e) - { - if (e.Reason == SearchBoxTextChangeReason.UserInput) - { - if (!string.IsNullOrWhiteSpace(sender.Query)) - { - var search = new FolderSearch - { - Query = sender.Query, - Folder = FilesystemViewModel.WorkingDirectory, - MaxItemCount = 10, - SearchUnindexedItems = UserSettingsService.PreferencesSettingsService.SearchUnindexedItems - }; - sender.SetSuggestions((await search.SearchAsync()).Select(suggestion => new SuggestionModel(suggestion))); - } - else - { - sender.AddRecentQueries(); - } - } - } - - private async void ModernShellPage_QuerySubmitted(ISearchBox sender, SearchBoxQuerySubmittedEventArgs e) - { - if (e.ChosenSuggestion is SuggestionModel item && !string.IsNullOrWhiteSpace(item.ItemPath)) - await NavigationHelpers.OpenPath(item.ItemPath, this); - else if (e.ChosenSuggestion is null && !string.IsNullOrWhiteSpace(sender.Query)) - SubmitSearch(sender.Query, UserSettingsService.PreferencesSettingsService.SearchUnindexedItems); - } - - public void SubmitSearch(string query, bool searchUnindexedItems) - { - FilesystemViewModel.CancelSearch(); - InstanceViewModel.CurrentSearchQuery = query; - InstanceViewModel.SearchedUnindexedItems = searchUnindexedItems; - ItemDisplayFrame.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), new NavigationArguments() - { - AssociatedTabInstance = this, - IsSearchResultPage = true, - SearchPathParam = FilesystemViewModel.WorkingDirectory, - SearchQuery = query, - SearchUnindexedItems = searchUnindexedItems, - }); - } - - private void ModernShellPage_RefreshRequested(object sender, EventArgs e) - { - Refresh_Click(); - } - - private void ModernShellPage_UpNavRequested(object sender, EventArgs e) - { - Up_Click(); - } - - private void ModernShellPage_ForwardNavRequested(object sender, EventArgs e) - { - Forward_Click(); - } - - private void ModernShellPage_BackNavRequested(object sender, EventArgs e) - { - Back_Click(); - } - protected override void OnNavigatedTo(NavigationEventArgs eventArgs) { base.OnNavigatedTo(eventArgs); @@ -402,54 +80,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) NavParams = navParams; } - private void AppSettings_SortDirectionPreferenceUpdated(object sender, SortDirection e) - { - FilesystemViewModel?.UpdateSortDirectionStatus(); - } - - private void AppSettings_SortOptionPreferenceUpdated(object sender, SortOption e) - { - FilesystemViewModel?.UpdateSortOptionStatus(); - } - - private void AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated(object sender, bool e) - { - FilesystemViewModel?.UpdateSortDirectoriesAlongsideFiles(); - } - - private void CoreWindow_PointerPressed(object sender, PointerRoutedEventArgs args) - { - if (IsCurrentInstance) - { - if (args.GetCurrentPoint(this).Properties.IsXButton1Pressed) - Back_Click(); - else if (args.GetCurrentPoint(this).Properties.IsXButton2Pressed) - Forward_Click(); - } - } - - private async void ModernShellPage_PathBoxItemDropped(object sender, PathBoxItemDroppedEventArgs e) - { - await FilesystemHelpers.PerformOperationTypeAsync(e.AcceptedOperation, e.Package, e.Path, false, true); - e.SignalEvent?.Set(); - } - - private void ModernShellPage_AddressBarTextEntered(object sender, AddressBarTextEnteredEventArgs e) - { - ToolbarViewModel.SetAddressBarSuggestions(e.AddressBarTextField, this); - } - - private async void ModernShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathItemLoadedEventArgs e) - { - await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, e.Item, this); - } - - private async void ModernShellPage_ToolbarFlyoutOpened(object sender, ToolbarFlyoutOpenedEventArgs e) - { - await ToolbarViewModel.SetPathBoxDropDownFlyoutAsync(e.OpenedFlyout, (e.OpenedFlyout.Target as FontIcon).DataContext as PathBoxItem, this); - } - - private void ModernShellPage_NavigationRequested(object sender, PathNavigationEventArgs e) + protected override void ShellPage_NavigationRequested(object sender, PathNavigationEventArgs e) { ItemDisplayFrame.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(e.ItemPath), new NavigationArguments() { @@ -458,61 +89,7 @@ private void ModernShellPage_NavigationRequested(object sender, PathNavigationEv }); } - private async void NavigationToolbar_QuerySubmitted(object sender, ToolbarQuerySubmittedEventArgs e) - { - await ToolbarViewModel.CheckPathInput(e.QueryText, ToolbarViewModel.PathComponents.LastOrDefault()?.Path, this); - } - - private void NavigationToolbar_EditModeEnabled(object sender, EventArgs e) - { - ToolbarViewModel.ManualEntryBoxLoaded = true; - ToolbarViewModel.ClickablePathLoaded = false; - ToolbarViewModel.PathText = string.IsNullOrEmpty(FilesystemViewModel?.WorkingDirectory) - ? CommonPaths.HomePath - : FilesystemViewModel.WorkingDirectory; - } - - private void DrivesManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == "ShowUserConsentOnInit") - DisplayFilesystemConsentDialog(); - } - - // WINUI3 - private static ContentDialog SetContentDialogRoot(ContentDialog contentDialog) - { - if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - contentDialog.XamlRoot = App.Window.Content.XamlRoot; - - return contentDialog; - } - - private async Task GetContentOrNullAsync() - { - // WINUI3: make sure not to run this synchronously, do not use EnqueueAsync - var tcs = new TaskCompletionSource(); - DispatcherQueue.TryEnqueue(() => - { - tcs.SetResult(ItemDisplayFrame.Content); - }); - return await tcs.Task as BaseLayout; - } - - private async void DisplayFilesystemConsentDialog() - { - if (App.DrivesManager?.ShowUserConsentOnInit ?? false) - { - App.DrivesManager.ShowUserConsentOnInit = false; - await DispatcherQueue.EnqueueAsync(async () => - { - DynamicDialog dialog = DynamicDialogFactory.GetFor_ConsentDialog(); - await SetContentDialogRoot(dialog).ShowAsync(ContentDialogPlacement.Popup); - }); - } - } - private NavigationParams navParams; - public NavigationParams NavParams { get => navParams; @@ -527,7 +104,7 @@ public NavigationParams NavParams } } - private void OnNavigationParamsChanged() + protected override void OnNavigationParamsChanged() { if (string.IsNullOrEmpty(NavParams?.NavPath) || NavParams.NavPath == "Home") { @@ -555,89 +132,15 @@ private void OnNavigationParamsChanged() } } - public static readonly DependencyProperty NavParamsProperty = - DependencyProperty.Register("NavParams", typeof(NavigationParams), typeof(ModernShellPage), new PropertyMetadata(null)); - - private TabItemArguments tabItemArguments; - - public TabItemArguments TabItemArguments - { - get => tabItemArguments; - set - { - if (tabItemArguments != value) - { - tabItemArguments = value; - ContentChanged?.Invoke(this, value); - } - } - } - - private IPaneHolder paneHolder; - - public IPaneHolder PaneHolder - { - get => paneHolder; - set - { - if (value != paneHolder) - { - paneHolder = value; - NotifyPropertyChanged(nameof(PaneHolder)); - } - } - } - - public event PropertyChangedEventHandler PropertyChanged; - - public event EventHandler ContentChanged; - - private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - - private void Page_Loaded(object sender, RoutedEventArgs e) - { - OnNavigationParamsChanged(); - Loaded -= Page_Loaded; - } - - private void FilesystemViewModel_PageTypeUpdated(object sender, PageTypeUpdatedEventArgs e) + protected override void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e) { - InstanceViewModel.IsPageTypeCloudDrive = e.IsTypeCloudDrive; - } - - private void FilesystemViewModel_OnSelectionRequestedEvent(object sender, List e) - { - // set focus since selection might occur before the UI finishes updating - ContentPage.ItemManipulationModel.FocusFileList(); - ContentPage.ItemManipulationModel.SetSelectedItems(e); - } - - private void FilesystemViewModel_DirectoryInfoUpdated(object sender, EventArgs e) - { - if (ContentPage is null) + if (string.IsNullOrWhiteSpace(e.Path)) return; - - var directoryItemCountLocalization = (FilesystemViewModel.FilesAndFolders.Count == 1) - ? "ItemCount/Text".GetLocalizedResource() - : "ItemsCount/Text".GetLocalizedResource(); - - ContentPage.DirectoryPropertiesViewModel.DirectoryItemCount = $"{FilesystemViewModel.FilesAndFolders.Count} {directoryItemCountLocalization}"; - ContentPage.UpdateSelectionSize(); - } - - private void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(e.Path)) - { - if (e.IsLibrary) - UpdatePathUIToWorkingDirectory(null, e.Name); - else - UpdatePathUIToWorkingDirectory(e.Path); - } + if (e.IsLibrary) + UpdatePathUIToWorkingDirectory(null, e.Name); + else + UpdatePathUIToWorkingDirectory(e.Path); } private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e) @@ -669,11 +172,21 @@ private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args) { args.Handled = true; + var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || + CurrentPageType == typeof(GridViewBrowser); + + // F2, rename + if (args.KeyboardAccelerator.Key is VirtualKey.F2 + && tabInstance + && ContentPage.IsItemSelected) + { + ContentPage.ItemManipulationModel.StartRenameItem(); + return; + } + var ctrl = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Control); var shift = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift); var alt = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu); - var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || - CurrentPageType == typeof(GridViewBrowser); switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.KeyboardAccelerator.Key) { @@ -727,7 +240,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo var items = SlimContentPage.SelectedItems.ToList().Select((item) => StorageHelpers.FromPathAndType( item.ItemPath, item.PrimaryItemAttribute == StorageItemTypes.File ? FilesystemItemType.File : FilesystemItemType.Directory)); - await FilesystemHelpers.DeleteItemsAsync(items, UserSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, true, true); + await FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, true, true); } break; @@ -763,7 +276,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo var items = SlimContentPage.SelectedItems.ToList().Select((item) => StorageHelpers.FromPathAndType( item.ItemPath, item.PrimaryItemAttribute == StorageItemTypes.File ? FilesystemItemType.File : FilesystemItemType.Directory)); - await FilesystemHelpers.DeleteItemsAsync(items, UserSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, false, true); + await FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, false, true); } break; @@ -790,7 +303,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo break; case (true, false, false, true, VirtualKey.H): // ctrl + h, toggle hidden folder visibility - UserSettingsService.FoldersSettingsService.ShowHiddenItems ^= true; // flip bool + userSettingsService.FoldersSettingsService.ShowHiddenItems ^= true; // flip bool break; case (false, false, false, _, VirtualKey.F1): // F1, open Files wiki @@ -825,76 +338,27 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo InstanceViewModel.FolderSettings.ToggleLayoutModeAdaptive(); break; } - - switch (args.KeyboardAccelerator.Key) - { - case VirtualKey.F2: //F2, rename - if (CurrentPageType == typeof(DetailsLayoutBrowser) - || CurrentPageType == typeof(GridViewBrowser)) - { - if (ContentPage.IsItemSelected) - ContentPage.ItemManipulationModel.StartRenameItem(); - } - break; - } } - public async void Refresh_Click() - { - if (InstanceViewModel.IsPageTypeSearchResults) - { - ToolbarViewModel.CanRefresh = false; - var searchInstance = new FolderSearch - { - Query = InstanceViewModel.CurrentSearchQuery ?? (string)TabItemArguments.NavigationArg, - Folder = FilesystemViewModel.WorkingDirectory, - ThumbnailSize = InstanceViewModel.FolderSettings.GetIconSize(), - SearchUnindexedItems = InstanceViewModel.SearchedUnindexedItems - }; - await FilesystemViewModel.SearchAsync(searchInstance); - } - else if (CurrentPageType != typeof(WidgetsPage)) - { - ToolbarViewModel.CanRefresh = false; - FilesystemViewModel?.RefreshItems(null); - } - } - - public void Back_Click() + public override void Back_Click() { ToolbarViewModel.CanGoBack = false; if (!ItemDisplayFrame.CanGoBack) return; - var previousPageContent = ItemDisplayFrame.BackStack[ItemDisplayFrame.BackStack.Count - 1]; - var previousPageNavPath = previousPageContent.Parameter as NavigationArguments; - previousPageNavPath.IsLayoutSwitch = false; - if (previousPageContent.SourcePageType != typeof(WidgetsPage)) - InstanceViewModel.FolderSettings.GetLayoutType(previousPageNavPath.IsSearchResultPage ? previousPageNavPath.SearchPathParam : previousPageNavPath.NavPathParam); // Update layout type - SelectSidebarItemFromPath(previousPageContent.SourcePageType); - - if (previousPageContent.SourcePageType == typeof(WidgetsPage)) - ItemDisplayFrame.GoBack(new EntranceNavigationTransitionInfo()); - else - ItemDisplayFrame.GoBack(); + base.Back_Click(); } - public void Forward_Click() + public override void Forward_Click() { ToolbarViewModel.CanGoForward = false; if (!ItemDisplayFrame.CanGoForward) return; - var incomingPageContent = ItemDisplayFrame.ForwardStack[ItemDisplayFrame.ForwardStack.Count - 1]; - var incomingPageNavPath = incomingPageContent.Parameter as NavigationArguments; - incomingPageNavPath.IsLayoutSwitch = false; - if (incomingPageContent.SourcePageType != typeof(WidgetsPage)) - InstanceViewModel.FolderSettings.GetLayoutType(incomingPageNavPath.IsSearchResultPage ? incomingPageNavPath.SearchPathParam : incomingPageNavPath.NavPathParam); // Update layout type - SelectSidebarItemFromPath(incomingPageContent.SourcePageType); - ItemDisplayFrame.GoForward(); + base.Forward_Click(); } - public void Up_Click() + public override void Up_Click() { ToolbarViewModel.CanNavigateToParent = false; if (string.IsNullOrEmpty(FilesystemViewModel?.WorkingDirectory)) @@ -933,121 +397,14 @@ public void Up_Click() } } - private void SelectSidebarItemFromPath(Type incomingSourcePageType = null) - { - if (incomingSourcePageType == typeof(WidgetsPage) && incomingSourcePageType is not null) - ToolbarViewModel.PathControlDisplayText = "Home"; - } - - public void Dispose() + public override void Dispose() { - PreviewKeyDown -= ModernShellPage_PreviewKeyDown; - PointerPressed -= CoreWindow_PointerPressed; - //SystemNavigationManager.GetForCurrentView().BackRequested -= ModernShellPage_BackRequested; //WINUI3 - App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged; - - ToolbarViewModel.ToolbarPathItemInvoked -= ModernShellPage_NavigationRequested; - ToolbarViewModel.ToolbarFlyoutOpened -= ModernShellPage_ToolbarFlyoutOpened; - ToolbarViewModel.ToolbarPathItemLoaded -= ModernShellPage_ToolbarPathItemLoaded; - ToolbarViewModel.AddressBarTextEntered -= ModernShellPage_AddressBarTextEntered; - ToolbarViewModel.PathBoxItemDropped -= ModernShellPage_PathBoxItemDropped; - ToolbarViewModel.BackRequested -= ModernShellPage_BackNavRequested; - ToolbarViewModel.UpRequested -= ModernShellPage_UpNavRequested; - ToolbarViewModel.RefreshRequested -= ModernShellPage_RefreshRequested; - ToolbarViewModel.ForwardRequested -= ModernShellPage_ForwardNavRequested; - ToolbarViewModel.EditModeEnabled -= NavigationToolbar_EditModeEnabled; - ToolbarViewModel.ItemDraggedOverPathItem -= ModernShellPage_NavigationRequested; - ToolbarViewModel.PathBoxQuerySubmitted -= NavigationToolbar_QuerySubmitted; ToolbarViewModel.RefreshWidgetsRequested -= ModernShellPage_RefreshWidgetsRequested; - - InstanceViewModel.FolderSettings.LayoutPreferencesUpdateRequired -= FolderSettings_LayoutPreferencesUpdateRequired; - InstanceViewModel.FolderSettings.SortDirectionPreferenceUpdated -= AppSettings_SortDirectionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortOptionPreferenceUpdated -= AppSettings_SortOptionPreferenceUpdated; - InstanceViewModel.FolderSettings.SortDirectoriesAlongsideFilesPreferenceUpdated -= AppSettings_SortDirectoriesAlongsideFilesPreferenceUpdated; - - if (FilesystemViewModel is not null) // Prevent weird case of this being null when many tabs are opened/closed quickly - { - FilesystemViewModel.WorkingDirectoryModified -= ViewModel_WorkingDirectoryModified; - FilesystemViewModel.ItemLoadStatusChanged -= FilesystemViewModel_ItemLoadStatusChanged; - FilesystemViewModel.DirectoryInfoUpdated -= FilesystemViewModel_DirectoryInfoUpdated; - FilesystemViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated; - FilesystemViewModel.OnSelectionRequestedEvent -= FilesystemViewModel_OnSelectionRequestedEvent; - FilesystemViewModel.Dispose(); - } - - if (ItemDisplayFrame.Content is IDisposable disposableContent) - disposableContent?.Dispose(); - } - - private void FilesystemViewModel_ItemLoadStatusChanged(object sender, ItemLoadStatusChangedEventArgs e) - { - switch (e.Status) - { - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Starting: - ToolbarViewModel.CanRefresh = false; - SetLoadingIndicatorForTabs(true); - break; - - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.InProgress: - SetLoadingIndicatorForTabs(true); - ToolbarViewModel.CanGoBack = ItemDisplayFrame.CanGoBack; - ToolbarViewModel.CanGoForward = ItemDisplayFrame.CanGoForward; - break; - - case ItemLoadStatusChangedEventArgs.ItemLoadStatus.Complete: - ToolbarViewModel.CanRefresh = true; - SetLoadingIndicatorForTabs(false); - // Select previous directory - if (!InstanceViewModel.IsPageTypeSearchResults && !string.IsNullOrWhiteSpace(e.PreviousDirectory)) - { - if (e.PreviousDirectory.Contains(e.Path, StringComparison.Ordinal) && !e.PreviousDirectory.Contains(CommonPaths.RecycleBinPath, StringComparison.Ordinal)) - { - // Remove the WorkingDir from previous dir - e.PreviousDirectory = e.PreviousDirectory.Replace(e.Path, string.Empty, StringComparison.Ordinal); - - // Get previous dir name - if (e.PreviousDirectory.StartsWith('\\')) - e.PreviousDirectory = e.PreviousDirectory.Remove(0, 1); - if (e.PreviousDirectory.Contains('\\')) - e.PreviousDirectory = e.PreviousDirectory.Split('\\')[0]; - - // Get the first folder and combine it with WorkingDir - string folderToSelect = string.Format("{0}\\{1}", e.Path, e.PreviousDirectory); - - // Make sure we don't get double \\ in the e.Path - folderToSelect = folderToSelect.Replace("\\\\", "\\", StringComparison.Ordinal); - - if (folderToSelect.EndsWith('\\')) - folderToSelect = folderToSelect.Remove(folderToSelect.Length - 1, 1); - - ListedItem itemToSelect = FilesystemViewModel.FilesAndFolders.Where((item) => item.ItemPath == folderToSelect).FirstOrDefault(); - - if (itemToSelect is not null && ContentPage is not null) - { - ContentPage.ItemManipulationModel.SetSelectedItem(itemToSelect); - ContentPage.ItemManipulationModel.ScrollIntoView(itemToSelect); - } - } - } - break; - } + + base.Dispose(); } - private void SetLoadingIndicatorForTabs(bool isLoading) - { - var multitaskingControls = ((App.Window.Content as Frame).Content as MainPage).ViewModel.MultitaskingControls; - - foreach (var x in multitaskingControls) - { - x.SetLoadingIndicatorStatus(x.Items.FirstOrDefault(x => x.Control.TabItemContent == PaneHolder), isLoading); - } - } - - public Task TabItemDragOver(object sender, DragEventArgs e) => SlimContentPage?.CommandsViewModel.CommandsModel.DragOver(e); - - public Task TabItemDrop(object sender, DragEventArgs e) => SlimContentPage?.CommandsViewModel.CommandsModel.Drop(e); - - public void NavigateHome() + public override void NavigateHome() { ItemDisplayFrame.Navigate(typeof(WidgetsPage), new NavigationArguments() @@ -1057,22 +414,10 @@ public void NavigateHome() }, new SuppressNavigationTransitionInfo()); } - public void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs) - { - NavigateToPath(navArgs.NavPathParam, sourcePageType, navArgs); - } - - public void NavigateToPath(string navigationPath, NavigationArguments? navArgs = null) - { - NavigateToPath(navigationPath, FolderSettings.GetLayoutType(navigationPath), navArgs); - } - - public void NavigateToPath(string? navigationPath, Type? sourcePageType, NavigationArguments? navArgs = null) + public override void NavigateToPath(string? navigationPath, Type? sourcePageType, NavigationArguments? navArgs = null) { if (sourcePageType is null && !string.IsNullOrEmpty(navigationPath)) - { sourcePageType = InstanceViewModel.FolderSettings.GetLayoutType(navigationPath); - } if (navArgs is not null && navArgs.AssociatedTabInstance is not null) { @@ -1122,19 +467,6 @@ public void NavigateToPath(string? navigationPath, Type? sourcePageType, Navigat ToolbarViewModel.PathControlDisplayText = FilesystemViewModel.WorkingDirectory; } - - public void RemoveLastPageFromBackStack() - { - ItemDisplayFrame.BackStack.Remove(ItemDisplayFrame.BackStack.Last()); - } - - public void RaiseContentChanged(IShellPage instance, TabItemArguments args) - { - ContentChanged?.Invoke(instance, args); - } - - private async void CreateNewShortcutFromDialog() - => await UIFilesystemHelpers.CreateShortcutFromDialogAsync(this); } public class PathBoxItem From 37e4b75bf273d602cd13875277fe820f079463df Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:56:22 -0500 Subject: [PATCH 4/5] Feature: Updated color icons (#11313) --- .../Assets/Custom Glyphs/Colored-Icons.ttf | Bin 6508 -> 9520 bytes .../Assets/Custom Glyphs/Colored_Icons.sfd | 1757 ++++++++++++----- .../Helpers/ContextFlyoutItemHelper.cs | 50 +- src/Files.App/UserControls/ColoredIcon.xaml | 25 +- .../UserControls/ColoredIcon.xaml.cs | 10 + .../UserControls/InnerNavigationToolbar.xaml | 31 +- .../ContextMenuFlyoutItemViewModel.cs | 3 + 7 files changed, 1354 insertions(+), 522 deletions(-) diff --git a/src/Files.App/Assets/Custom Glyphs/Colored-Icons.ttf b/src/Files.App/Assets/Custom Glyphs/Colored-Icons.ttf index 90a77fa41d7ab0fb4b7e87ef1577e619af8a4de0..cbf922b8e0f87aa271bcf672fd932d302c191bbb 100644 GIT binary patch literal 9520 zcmds7d2n3CneVUP9BT8_Ay~GNEnypkBxKpf z1Y@uvTPE2`mH=VFRZ+NVLs0}+ppu1bC2W>s!Ze5+|u>(P)4D=CBNG zHvjI!T-GAA1W6Imia-MbM~^UBWkziCu!W2k?86 zh0({@0yVM+Ss%}^uL5TaFR_cMjorY0!#;)bD6_Bu`XU=(|7pC#*q?!Qn9ZZS4Nvjm zRf^1u)5gckOzhKmn(zg!PHh1nuv1Y{qHaPdp)_M;D=21T3R9T|zH=}qb1|K{nFnL| zn4bk$18ZbK*2F@rnYFMm1COy7i?ddiU`du@E7(f5inX!TtR1xOWL+%HGAzq-EYAw8 z$iN$95z|&ag4*?yt+pARlF4kb$~HyS><*_(cYC}(f1sf;*c57R2}h!_cxxh=TCs9f z+v@g?&aQMOo68r9g7N;(d<@wHt;BZ&yNYowEaS=AGHm`lh-eND^%eyKRl!%N-#P5wD>4D;j) zMcwPqMjaH7#*+ENvF5Dg_mDpjkEJ>Y;}?3Uk9sKM4`eg` zW{T%?$u`0!k^(JL5VaUx+LBgw+1+mYn^xa~O^LJ>Q@fOO%hRGcRp@iuMePlb{b_;o zw4IN~LvH(`+wO^lxHTK&ze^RH;_;?pYWsG(I~2bv=ynG^1|8^0tnnc_`Qda3ypImt zLu*pSVygUns!)*Kc3LAQEI)5|(@C^yqK{6eirdSY-Q%&-X>{Y9`j!qzSMmGUxr_z$ zT(OUe*mb6bELIT2>LAc0&_V&6UZz+m7V^1NE}s)nv0xCz3mmJ(8WkiJK#j z1e1E~KXUkOvSK#7G}XZ~LAPd-h{z;aEUM-ai2mT>OO1g*Oi`UY-{=p-RK?TiCYwzT z*cV@MsG7@cc580k>u}iZip^%Rnk2VZ?V?U3W5~;4yUTPTu#@j4bf;RVo_y> zs;Hq*S9;yx4y@X)QiDa3)bg)2=MR41aqI5$bNLH{jgClbYcjcF#Y(@=8j@#J)p?Xl zk}c%%bTpaFc+qs}@NlsZiI{J3DXLn2$6~R_PCS+I?|ttGh{Vl)|8Oqb-{AARbVV}} z$Jf{^gKV6{d3m5)nJ4S3vn`;c;8`%H5REp<<9vkR06MX-AdY`wp?`FgpQ?lX3;e!P zAypnu6-uN1^i==o;>Cp&J!MqO!~LTr!G}Z#A=3pkhe9`iv!ol<1fnGvE1) zV7XFBlxILG;tsmsyB!7oq)8MQh7B$~#~b)qGWSSfvtO`MCl{g)am?$YMjceV z=oN``lZkUKnE**I%d*ugOY=^UmF5MAQ>15JmOvs~-MXmu1Z+^Ow1%N|MVZ z%@hAS47~X8yksT^mhh6z0@aKjNmZqJzR9G3ZrzYAA-|woBI^?x@cn0FC^hOXK{UI? zv25EmFgiL=eqmsAW}6|fXf0J5MhCE3=q>hTehqltDOT@!pKdfmC&iqQ!{GX?%?f|3+L01S-&b0^q7x|F6$Mkl8eFpUDd`UWGApr< zv;EjZn2KvDC*(d%KCi_J^_R@&3MDW_7UJ*ZJsi5iYjIK=4z82(kRi~wnd2#e87r?? ztj)l|83RGQ9K|~r566vTU(2CJ+E9odK5BiJ+;+`PRBE^W((ZO@re8|ZyTPH5`41-Z zFHM?Lv{>8v#L2q@Zhm_8^~Wk`-WFbe6XTpg;XzOB%~KXJN(H~;T*+fsG1KWF513CI z!-197uC~^uvAnxlq9+6rZ}Ogb4O8=FSY}U2>K*UDI?sPo@Xc=|P9))-;F+_{T&V{{>wDkBb>r5cD$`2KF=?rB<4^ zdt9oye7W(UdHM);tcz{yT+9tma;tO)Ey9XIkZ}^V0{|-qgjrj5h8Xbdx-f9Ccd6VhpZL7c^yKdhlD$N^@YSXfAde2zOmfmwVnGEQKHG*yY1rv#f|JnRp3BYTvmNb;)}|(hQ#1~@ zcVzQ3xmB}REKFww04NG ztK&Ew4rj1w7}Md*;Q7yR6EA>YgcFb}7#t%(P=p5pRg|O$n^K`rN_97Sgt7d+s5F(o zvY>f9+JdmVc+H?^HzK77Y~ng$Cxpo2gqsOu>ZD}810ouQst`tA7i7x9Zuc!(K)+fetz`mE9H&(ZT*vo8M~TE-IuV<;NUKTREIpxY-k0L8}za*HHeP zVP?u#b_NC#Q>o&r+`l)3R?~ED6&0jN$Ew6=|0#Q;EK9*is;Fh-q4KSPoUcXGeEMiV zf3$z}nNmx%n0h7>iiJ}J&_wt_C+RBC1d*Rf2oR`|f~v#%umRzXfu%ErwNONcS0_)>TNi2-$@^*xen`j*h4va(cbaor}W_VWMyYe@dJy zBEk&6hQ5S|EPy&>7WT4oXv<(a9`tyE?pF+7lD<@N1DCsm27DHuIE9rmW%_uogU1}) z+d`&D2f6wv(n2l^-Shap`v(X2-&=XmvGS>3ee#pPA{WYA>&>F~=4$J&fB_OB(#`PS zLH}WNw{R7zoLqGupn+oW&El~IcnmlN!)vGj6h5meTngAE#KQOSt;jfNh(wWxpcXjj z!u3h{;(9ut^#$;woxVdCIvnc`t}G3`?W8ZS-&*R;-c2@DeX~?TRQn+8+EuV?3S!s@ zBGfJ;3N>t*p#%d-VdD%Nm1q%`&ggR2ly>!5FjROlMr+O=*?eg8rtk2r-D@{*UR(Tl z`Q39iqvf*84DAjDkH3ZVx~{Hu^zfE7y<4{Q<}dqZ|HpuG5z(au(NOp}y=7pOJzWC- zHRGkKfBq2ceRI{?$171!Gevz-BV4KZeG7DYWU7QXNXre;!SeB;+`_`h)D(YfYD9!U zeI*efm8M1n8Y7;m`X(awHk?FVdT46o89G@W9+~2^25)?oj!T`$Xc)GOtWvTMUNd?6 zKy<4_uO?5*7Js9aT7P71^jqYU^z0hitu{K$YWY#xsG1#(YWeSlA0c9`hakTpWCd0W zt_@R#z=E#DlvNlaA=Gfoi(H5`DBD_n($8bIo7>XZ$%(1XtFP|FV`?PbcJr>GJwro# z_*&yZSK6Ozn7Ri&gZcaK&kq9oo~efC%DZ+C4ecHtHcG5x%hETbhxiouW+ieD3_@#o ze=w`idnx$N#cW2XkfIKw0{sYM5=Z#s&w8LGeF1nRqM7czl7m zzop44U+K^e!Oa~!4+ny!AC8 z7yC4&Ql6^_r(CI&VTY&xTzYo9(|wh@$$c(ujC1O+T70V{lb1+%xo-G_-Js*Jq0P7qNrEr$Ky?}b(tC(HOmvG{QO4#tfH20yKMatO;Z96dRr|& z^+Tbv+Lo>c-5Zc+5ZOambYYLgmMY6nMXhJm6Dsi$xlMk@FV=je)9rS;vgIFU-J&`v z3P0WQiR-xJ^DRDv#pCbDk;?NMlr6uE^>TK@(p}Pi+6g`BV9e|{(g!%#Lcm74bcIva z7e`!8+^6tR+1xLO8+7^`&2B9prbPJ-EE3tZJEbH1n}S~{D|`uXi3LdlgWwrBwD66R zDdD?{FeRB2Aq07y#BWkIlrlX%x$`avXkM=t=*cA8+LB%Q@~gu#cQq-;WcirV=#q!| zc|6fPI=L;B;#ho>xBr5YFUW_~29HU;Sqa*X$=uf<4`VN%TDns@TH8y23Q+ofOA0(& zjOusu=M*1raxISN@>l7<`sp64T`M2bgFGCe1W19s+`#UVeAT@~Q^{N({B1whYUv>1 ze~ZW$9wDq~^;BT|Aq#~f9if%Ova7MO<|Y@Hhs&?#yTpESJw9W1BLlg$J-N~be%`R$ z;N$W!TTr=KHhCJX zuOr7`WMD+po^0br8p4Vg9q9=pI>$QUs)ztSQOQm8P)eFn6kYfG8~>z-k<|(yQ%GM6 z`u$NwfmFRK8f-9SRix8MA;3d-+m!MPCbN#5;%8r>FP7bne!s3OiX*HmA_qb5AnH`q z7&019lhN`g*-5S{mSS_4m)wECq+L^Wv*{H(=d3F#33 zN91Z_$bDT1Ip2z0;|;Jbl?;vu@UYejjX`1&tARh_DPJ}pFqAZuCQKv!mFPW?59?on ze7zl+7L(Z~%Rc*lO;u&tY^qfD->$jc8oe&c#pwTnc8ROmUVig`Mxy7%j%`>;NicxNc0g$|Si&{{ zmKgc~8yIW>2Dx0EKM&=8L= zp5Pax*R4x0K7o>78*ez%*Hdjx3k)F_gxiTW{vwwQuT{9vHE(q-k+A(m_<*!qw^I_# z+NhU5Z)4y#A-tv#c>HoBRr>r;FXfM{yL`(oZ^8YKoLB6{d-y|wYoN9by zt>}qDE>(+d%8Rz3+qV7@5y?EV-sTS44%=*%=%z)~Ho%?UAW#n5g2v^QpxFWGGVVis zgPgZVB;}15IUCJZVrnFDjhGtw!(!o#K7iI0UXb`^VJs~1dy&92v?iUNlr^Ds%W_RA zD#INsQoTApAv^q!=H>_|Jrs&@(&X}1yOGm%XfD-eQ(Zc4aA+;wT>PY4?^&^;{f$^C zq?i9G(j4;pG_6@j;zQh0{h9qndXfJEmb@9aO6_QaJK{$yoPtZri-ogl%y1<|23u&W zjGvkV(qWUm(Qi7;xka(O06@|j(Z~r^8bkPui26k3!G8hkIjjX>MCmDurpjb`e?xgC z@N0iqi?~Zb?!w5)iSt_?Lm`ghwK}~ohXeIDH*b8#lVkgEvq-t_hdS4w5cO`rM%!fVrcqM^d$y+an1@B1gHgT84H{$j( zj5v=a&Pu}yyIa$BaIm51Bsf>XGm1eM!(1csK3LDqmY=VKqXXS~oAQRztZviY4Gv}9 znRIRW`FiH|#K0)M>T(C1z*M&51w$8doaK{r8Zo>Dt723M<8Y5A4vJ12k(*J_mqf@W zT5>~TGt7r8HzTbGxDhv~6_`NFomH44R=d6mOOTbD)nV8+TcX}$))s^n( z>O#X`9t}1^e3qWX3c;F2WqGm2Xcd=H60*}~+`CvwCh!)iq>&x!2mUeXgft|1$wz() zPy;nmkeVn&%}@|wicpkd6i5C#fox`qR?tdX1+}%B+KpR-E=m)^aLQ4h3RJZ1!V&J+ zIks;?Goa}M6SI?Jhm@JIeRC5=yS)O|I`-`uo2_N*f%jbv1<<0GDcO;RHv=`Cg#TW?bum;PAg(1Gh=gmcI-R@PHQu>(=!vZb9*O% zy1X*2PE8!VVtR6XVs^*QW$?5-jw!`1YQVG^m^*eF<+QwWc5G@F=BNSFmYK0BU{@Z~ z=3V=-dZV1SjbLjRPIMHqbtqSd@^z?Chl+KmyAG|XLB*~*l&(XWI#i#dSf8UN;9cq@`G(ZAA#J6v_nKBi|ktl620Bu6as(%hiJbxSIGU2G{qG zel+>Jy#UNfvc|#9V}1y*tpEbwFRts~G@8qiCMfA3UbpV)txxXUIsY!LzYb8ea(He3 zP+9%Cf704V^iK>Aug&yJeqjkIBZUwiUO%>_;=ExG@oy5}^YpWW{f~toA0P#*h+nn7 zf6FLrfTOfNpLqW>{p;6GeQc};aDGFehDM*=GtUfOdfZyXu;(~hZVpLOAX zz$o0N=ip;@`~yDToSVLK0|L1o;T@(DuLH)#^r45Cn(Kj{!UMuPc~ynA0u}R;O4tnA zY#W9=zbEk?wwuw2pFlm5CI%XPwq9^MS3bFT2zK5J+-n#7x%tpThaJft!9eB$*1$L( zg6;4%jNpsVj_+b01fh#{pa@;ih40aSn)Xb<5Y}J`9D&WO3dUI(bhB3Y9#+E+_&dBr zlz-SP%s3AMeVibIpGJ|sWYWEM3J=^1X!tTjw6g5C%zx6 z(5hqH4w~Q|K4~TR>KNgt5%bR8L;0*w=FYhFa==K&F1m)TAjT!nSqlWFY{ zD4t)#4q-n#2Bko`ferCQIV(de)5?)%l(dpoPPSk&*1#he3R*GAF_oh$$$CRp;l3Uv z;l3p-SoZI>$;@?ppQ+VhzLyd#dw#|va)Q~$97RUqU;1LbaL;UVXf~j2i^b_W`i99n zwzR`+pE4PG$(D{I3&N(yT#O*Z#@Wls6pqPEAGAY1Z>#8l7UDiLh5a;jL&$ zN3koKp1EJ)#V&6+k&db-qUi?G1c)!@GVBTVVRnZuF!%5wqs?Y)XyEj_Df`gow$0dy z(2w0ElKqqJw$#TP7ycppTYVtY*OHJiCMObdZ*OYNnv^=3>RH*#c`j|~;Q|upu?OKO z+e$si3YBy|g_JUihmEIv%&xQ|0z#_#>OgjLuF%Q<>qqZ z7e=?=c&V&fgMN#l(jo|&AvV)ksczuA@F$gxYPIpU(eE~1F0U3Pz0t0dv>F^dIbs-P znJ!A}eN>x9@DL=W44oDX)=?gXgBEm_q0)kJ8GrQoxzW*coZ!pnUhV69l@m5u5RtsT zAR#d?mG_{X5@LqTBAvXHc|L}yPI!LGirc9T%5j|L1)AYGXcvPeCBYILp{U-XJ_2%w9Z_XV=1UfLZ(a}c zcr1SmCx;%)@R&g-s+aU;8c@j(4{_Y$A+q>+cADHzm!0UBZ3(~ICi)XL*{`*+pR1?t z+`&ig%zT1Dd2&*{IXT4HJL;)7Co#wc6f>lIZ-||yE5DSu>{(l>j5Sunell%8cST`> z!T)2qd~eZLrp>uu2^-lj!AE+sxguYNuJKdpzC@~4eWW&pOVqbgwb!qwsf3R8rE62E z+GIj~t2UMBOY?1X9w4jYI`ArJi6IYFW0A07dGe2VMIB%CeHNfSLjGbMVVCJWr3w_< zM>WBFEw8VJcrqgKJAz6rk%=juq#(DT+ryl0etQPR*%9x{PnP)?4-D+?k9Dt^+rN8Y zU~y%5=r5AS<&}Qe+}+&Vje~{ZmHD{OG{843QFgpk*TNqfa2~)WV~JH`oH@w%&i=Ro zW%vsFlE6s-UX0L{P=*p)Ebo)NF0F(I=HD@DEndUPg^nK!*_m>sGz^z!Uz$XqJ7RXO z0UO4$OZ^K6dQugk"6g*8Ih51+E<#t=!(fUS7'8jaJcGcN EndImage2 Fore SplineSet -282.107421875 681.3125 m 2 - 717.893554688 681.3125 l 2 - 808.15625 681.3125 881.313476562 608.155273438 881.313476562 517.892578125 c 1 - 826.840820312 517.892578125 l 1 - 826.840820312 578.0859375 778.086914062 626.83984375 717.893554688 626.83984375 c 2 - 282.107421875 626.83984375 l 2 - 221.9140625 626.83984375 173.16015625 578.0859375 173.16015625 517.892578125 c 2 - 173.16015625 463.419921875 l 1 - 500 463.419921875 l 1 - 500 408.946289062 l 1 - 173.16015625 408.946289062 l 1 - 173.16015625 82.1064453125 l 2 - 173.16015625 21.9130859375 221.9140625 -26.8408203125 282.107421875 -26.8408203125 c 2 - 500 -26.8408203125 l 1 - 500 -81.3134765625 l 1 - 282.107421875 -81.3134765625 l 2 - 191.844726562 -81.3134765625 118.6875 -8.15625 118.6875 82.1064453125 c 2 - 118.6875 517.892578125 l 2 - 118.6875 608.155273438 191.844726562 681.3125 282.107421875 681.3125 c 2 +250 737.5 m 2 + 750 737.5 l 2 + 853.556640625 737.5 937.5 653.552734375 937.5 550 c 1 + 875 550 l 1 + 875 619.03515625 819.037109375 675 750 675 c 2 + 250 675 l 2 + 180.96484375 675 125 619.03515625 125 550 c 2 + 125 487.5 l 1 + 500 487.5 l 1 + 500 425 l 1 + 125 425 l 1 + 125 50 l 2 + 125 -19.037109375 180.96484375 -75 250 -75 c 2 + 500 -75 l 1 + 500 -137.5 l 1 + 250 -137.5 l 2 + 146.447265625 -137.5 62.5 -53.556640625 62.5 50 c 2 + 62.5 550 l 2 + 62.5 653.552734375 146.447265625 737.5 250 737.5 c 2 EndSplineSet Validated: 1 EndChar @@ -2188,16 +2249,16 @@ EndChar StartChar: pane_o Encoding: 60 57404 27 Width: 1000 -Flags: H +Flags: HW LayerCount: 2 Fore SplineSet -881.314453125 464.265625 m 1 - 881.314453125 77.36328125 l 2 - 881.314453125 -10.2783203125 822.119140625 -81.3115234375 749.083984375 -81.3115234375 c 2 - 554.485351562 -81.3115234375 l 1 - 554.485351562 464.265625 l 1 - 881.314453125 464.265625 l 1 +937.5 487.5 m 1 + 937.5 50 l 2 + 937.5 -53.556640625 853.556640625 -137.5 750 -137.5 c 2 + 562.5 -137.5 l 1 + 562.5 487.5 l 1 + 937.5 487.5 l 1 EndSplineSet Validated: 1 EndChar @@ -2209,38 +2270,18 @@ Flags: H LayerCount: 2 Fore SplineSet -505.87109375 410.770507812 m 1 - 544.116210938 354.583007812 l 1 - 544.0625 354.5 l 1 - 645.987304688 204.608398438 l 2 - 665.24609375 212.383789062 686.291992188 216.662109375 708.333007812 216.662109375 c 0 - 800.37890625 216.662109375 875 142.041992188 875 49.99609375 c 0 - 875 -42.0537109375 800.37890625 -116.670898438 708.333007812 -116.670898438 c 0 - 616.287109375 -116.670898438 541.666992188 -42.0537109375 541.666992188 49.99609375 c 0 - 541.666992188 97.50390625 561.545898438 140.375 593.44140625 170.733398438 c 2 - 507.416992188 297.241210938 l 1 - 418.43359375 158.204101562 l 2 - 443.3125 129.087890625 458.333007812 91.2958984375 458.333007812 49.99609375 c 0 - 458.333007812 -42.0537109375 383.713867188 -116.670898438 291.666992188 -116.670898438 c 0 - 199.619140625 -116.670898438 125 -42.0537109375 125 49.99609375 c 0 - 125 142.041992188 199.619140625 216.662109375 291.666992188 216.662109375 c 0 - 319.725585938 216.662109375 346.165039062 209.729492188 369.366210938 197.479492188 c 2 - 469.19140625 353.454101562 l 1 - 255.407226562 667.838867188 l 2 - 245.703125 682.110351562 249.405273438 701.547851562 263.676757812 711.252929688 c 0 - 277.94921875 720.95703125 297.385742188 717.255859375 307.090820312 702.983398438 c 2 - 505.833007812 410.713867188 l 1 - 505.87109375 410.770507812 l 1 -187.5 49.99609375 m 0 - 187.5 -7.533203125 234.13671875 -54.1708984375 291.666992188 -54.1708984375 c 0 - 349.196289062 -54.1708984375 395.833007812 -7.533203125 395.833007812 49.99609375 c 0 - 395.833007812 107.525390625 349.196289062 154.162109375 291.666992188 154.162109375 c 0 - 234.13671875 154.162109375 187.5 107.525390625 187.5 49.99609375 c 0 -604.166992188 49.99609375 m 0 - 604.166992188 -7.533203125 650.803710938 -54.1708984375 708.333007812 -54.1708984375 c 0 - 765.862304688 -54.1708984375 812.5 -7.533203125 812.5 49.99609375 c 0 - 812.5 107.525390625 765.862304688 154.162109375 708.333007812 154.162109375 c 0 - 650.803710938 154.162109375 604.166992188 107.525390625 604.166992188 49.99609375 c 0 +462.73828125 450.418945312 m 1 + 425.477539062 393.041992188 l 1 + 192.544921875 751.7265625 l 2 + 183.145507812 766.201171875 187.259765625 785.5546875 201.733398438 794.955078125 c 0 + 216.208007812 804.354492188 235.5625 800.241210938 244.961914062 785.766601562 c 2 + 462.73828125 450.418945312 l 1 +537.26171875 450.418945312 m 1 + 755.037109375 785.766601562 l 2 + 764.4375 800.241210938 783.793945312 804.354492188 798.268554688 794.955078125 c 0 + 812.744140625 785.5546875 816.856445312 766.201171875 807.456054688 751.7265625 c 2 + 574.5234375 393.041992188 l 1 + 537.26171875 450.418945312 l 1 EndSplineSet Validated: 33 EndChar @@ -2252,14 +2293,35 @@ Flags: H LayerCount: 2 Fore SplineSet -580.75390625 411.830078125 m 1 - 542.508789062 468.018554688 l 1 - 692.420898438 702.258789062 l 2 - 701.724609375 716.794921875 721.053710938 721.037109375 735.587890625 711.733398438 c 0 - 750.125 702.430664062 754.366210938 683.104492188 745.0625 668.567382812 c 2 - 580.75390625 411.830078125 l 1 +500.002929688 362.5 m 0 + 510.452148438 362.5 520.208984375 357.278320312 526.004882812 348.583984375 c 2 + 657.84375 150.825195312 l 2 + 685.056640625 166.21875 716.505859375 175 750 175 c 0 + 853.556640625 175 937.5 91.056640625 937.5 -12.5 c 0 + 937.5 -116.056640625 853.556640625 -200 750 -200 c 0 + 646.443359375 -200 562.5 -116.056640625 562.5 -12.5 c 0 + 562.5 34.912109375 580.099609375 78.21875 609.122070312 111.237304688 c 2 + 500.002929688 274.913085938 l 1 + 390.881835938 111.231445312 l 2 + 419.90234375 78.212890625 437.5 34.912109375 437.5 -12.5 c 0 + 437.5 -116.056640625 353.552734375 -200 250 -200 c 0 + 146.447265625 -200 62.5 -116.056640625 62.5 -12.5 c 0 + 62.5 91.056640625 146.447265625 175 250 175 c 0 + 283.498046875 175 314.9453125 166.212890625 342.162109375 150.825195312 c 2 + 474.001953125 348.583984375 l 2 + 479.797851562 357.278320312 489.5546875 362.5 500.002929688 362.5 c 0 +375 -12.5 m 0 + 375 56.537109375 319.03515625 112.5 250 112.5 c 0 + 180.96484375 112.5 125 56.537109375 125 -12.5 c 0 + 125 -81.537109375 180.96484375 -137.5 250 -137.5 c 0 + 319.03515625 -137.5 375 -81.537109375 375 -12.5 c 0 +875 -12.5 m 0 + 875 56.537109375 819.037109375 112.5 750 112.5 c 0 + 680.962890625 112.5 625 56.537109375 625 -12.5 c 0 + 625 -81.537109375 680.962890625 -137.5 750 -137.5 c 0 + 819.037109375 -137.5 875 -81.537109375 875 -12.5 c 0 EndSplineSet -Validated: 33 +Validated: 1 EndChar StartChar: NameMe.63 @@ -2317,6 +2379,7 @@ SplineSet 182.271484375 556.288085938 l 1 182.272460938 556.288085938 l 1 EndSplineSet +Validated: 5 EndChar StartChar: NameMe.64 @@ -2372,6 +2435,7 @@ SplineSet 704.51171875 386.303710938 l 1 704 450 l 1 EndSplineSet +Validated: 1 EndChar StartChar: NameMe.65 @@ -2402,6 +2466,7 @@ SplineSet 299.0078125 582.912109375 l 1 219.135742188 365.82421875 l 1 EndSplineSet +Validated: 5 EndChar StartChar: NameMe.66 @@ -2446,6 +2511,7 @@ SplineSet 495.616210938 109.82421875 l 1 741.375976562 109.82421875 l 1 EndSplineSet +Validated: 1 EndChar StartChar: NameMe.67 @@ -2470,6 +2536,7 @@ SplineSet 192.51171875 -39.6796875 l 1 700.416015625 -39.6796875 l 1 EndSplineSet +Validated: 1 EndChar StartChar: NameMe.68 @@ -2518,6 +2585,7 @@ SplineSet 641.024414062 578.814453125 l 1 641.024414062 578.81640625 l 1 EndSplineSet +Validated: 37 EndChar StartChar: NameMe.69 @@ -2543,6 +2611,7 @@ SplineSet 831.48828125 253.182617188 l 1 323.583984375 -39.6796875 l 1 EndSplineSet +Validated: 33 EndChar StartChar: NameMe.70 @@ -2591,6 +2660,710 @@ SplineSet 382.9765625 578.817382812 l 1 382.975585938 578.81640625 l 1 EndSplineSet +Validated: 5 +EndChar + +StartChar: NameMe.71 +Encoding: 71 -1 38 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +880 417.1875 m 2 + 880 -77.443359375 l 2 + 880 -93.71875 876.581054688 -109.34375 869.744140625 -124.318359375 c 0 + 863.237304688 -138.962890625 854.28125 -151.987304688 842.887695312 -163.380859375 c 0 + 831.825195312 -174.443359375 818.799804688 -183.400390625 803.825195312 -190.237304688 c 0 + 789.181640625 -196.744140625 773.71875 -200 757.443359375 -200 c 2 + 509.8828125 -200 l 1 + 521.276367188 -190.887695312 532.181640625 -181.119140625 542.59765625 -170.700195312 c 0 + 553.014648438 -160.287109375 562.6171875 -149.21875 571.40625 -137.5 c 2 + 755 -137.5 l 2 + 763.787109375 -137.5 771.924804688 -135.875 779.412109375 -132.619140625 c 0 + 786.900390625 -129.362304688 793.412109375 -124.96875 798.943359375 -119.431640625 c 0 + 804.806640625 -113.575195312 809.362304688 -106.900390625 812.619140625 -99.412109375 c 0 + 815.875 -91.9248046875 817.5 -83.787109375 817.5 -75 c 2 + 817.5 417.1875 l 2 + 817.5 418.489257812 817.5 419.791992188 817.5 421.09375 c 0 + 817.5 422.395507812 817.337890625 423.698242188 817.012695312 425 c 2 + 627.55859375 425 l 2 + 610.630859375 425 594.681640625 428.41796875 579.70703125 435.25390625 c 0 + 565.05859375 442.08984375 552.200195312 451.204101562 541.1328125 462.59765625 c 0 + 530.065429688 473.990234375 521.276367188 487.174804688 514.765625 502.1484375 c 0 + 508.254882812 517.448242188 505 533.3984375 505 550 c 2 + 505 737.01171875 l 2 + 503.698242188 737.337890625 502.395507812 737.5 501.09375 737.5 c 0 + 499.791992188 737.5 498.489257812 737.5 497.1875 737.5 c 2 + 255 737.5 l 2 + 246.2109375 737.5 238.073242188 735.872070312 230.5859375 732.6171875 c 0 + 223.098632812 729.362304688 216.42578125 724.8046875 210.56640625 718.9453125 c 0 + 205.032226562 713.411132812 200.637695312 706.901367188 197.3828125 699.4140625 c 0 + 194.127929688 691.926757812 192.5 683.7890625 192.5 675 c 2 + 192.5 428.41796875 l 2 + 170.690429688 422.55859375 149.856445312 414.74609375 130 404.98046875 c 1 + 130 677.44140625 l 2 + 130 693.717773438 133.254882812 709.1796875 139.765625 723.828125 c 0 + 146.6015625 738.801757812 155.553710938 751.823242188 166.62109375 762.890625 c 0 + 178.014648438 774.284179688 191.03515625 783.235351562 205.68359375 789.74609375 c 0 + 220.657226562 796.58203125 236.282226562 800 252.55859375 800 c 2 + 497.1875 800 l 2 + 513.7890625 800 529.739257812 796.745117188 545.0390625 790.234375 c 0 + 560.338867188 784.049804688 573.84765625 775.09765625 585.56640625 763.37890625 c 2 + 843.380859375 505.56640625 l 2 + 855.099609375 493.84765625 864.049804688 480.338867188 870.237304688 465.0390625 c 0 + 876.744140625 449.739257812 880 433.7890625 880 417.1875 c 2 +567.5 550 m 2 + 567.5 541.2109375 569.127929688 532.91015625 572.3828125 525.09765625 c 0 + 575.637695312 517.610351562 580.032226562 511.099609375 585.56640625 505.56640625 c 0 + 591.099609375 500.032226562 597.610351562 495.637695312 605.09765625 492.3828125 c 0 + 612.91015625 489.127929688 621.2109375 487.5 630 487.5 c 2 + 773.556640625 487.5 l 1 + 567.5 693.5546875 l 1 + 567.5 550 l 2 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.72 +Encoding: 72 -1 39 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +514.475585938 -29.8642578125 m 0 + 500.689453125 -62.03515625 481.84765625 -90.064453125 457.950195312 -113.96484375 c 0 + 434.053710938 -137.858398438 406.01953125 -156.858398438 373.8515625 -170.947265625 c 0 + 341.681640625 -184.735351562 307.368164062 -191.629882812 270.91015625 -191.629882812 c 0 + 234.145507812 -191.629882812 199.678710938 -184.735351562 167.509765625 -170.947265625 c 0 + 135.33984375 -157.165039062 107.306640625 -138.317382812 83.41015625 -114.423828125 c 0 + 59.5126953125 -90.5234375 40.6708984375 -62.494140625 26.8837890625 -30.3232421875 c 0 + 13.09765625 1.8466796875 6.2041015625 36.3115234375 6.2041015625 73.076171875 c 0 + 6.2041015625 109.53515625 13.09765625 143.846679688 26.8837890625 176.017578125 c 0 + 40.9775390625 208.188476562 59.97265625 236.219726562 83.869140625 260.1171875 c 0 + 107.766601562 284.013671875 135.799804688 302.85546875 167.96875 316.642578125 c 0 + 200.137695312 330.736328125 234.452148438 337.782226562 270.91015625 337.782226562 c 0 + 295.11328125 337.782226562 318.397460938 334.565429688 340.762695312 328.131835938 c 0 + 363.434570312 322.00390625 384.57421875 313.119140625 404.181640625 301.477539062 c 0 + 423.790039062 290.141601562 441.711914062 276.354492188 457.950195312 260.1171875 c 0 + 474.188476562 243.879882812 487.974609375 225.956054688 499.310546875 206.346679688 c 0 + 510.953125 186.741210938 519.837890625 165.599609375 525.96484375 142.9296875 c 0 + 532.3984375 120.564453125 535.616210938 97.2822265625 535.616210938 73.076171875 c 0 + 535.616210938 36.6171875 528.569335938 2.3056640625 514.475585938 -29.8642578125 c 0 +411.995117188 96.51171875 m 2 + 294.34765625 214.161132812 l 2 + 287.913085938 220.595703125 280.1015625 223.811523438 270.91015625 223.811523438 c 0 + 261.71875 223.811523438 253.90625 220.595703125 247.47265625 214.161132812 c 2 + 129.825195312 96.51171875 l 2 + 123.391601562 90.08203125 120.174804688 82.2705078125 120.174804688 73.076171875 c 0 + 120.174804688 63.888671875 123.391601562 56.0703125 129.825195312 49.6416015625 c 0 + 136.259765625 43.2060546875 144.071289062 39.98828125 153.262695312 39.98828125 c 0 + 162.454101562 39.98828125 170.266601562 43.2060546875 176.700195312 49.6416015625 c 2 + 241.498046875 114.435546875 l 1 + 241.498046875 -44.5703125 l 2 + 241.498046875 -52.53515625 244.409179688 -59.4296875 250.23046875 -65.2529296875 c 0 + 256.05078125 -71.0703125 262.944335938 -73.982421875 270.91015625 -73.982421875 c 0 + 278.875976562 -73.982421875 285.768554688 -71.0703125 291.58984375 -65.2529296875 c 0 + 297.411132812 -59.4296875 300.321289062 -52.53515625 300.321289062 -44.5703125 c 2 + 300.321289062 114.435546875 l 1 + 365.119140625 49.6416015625 l 2 + 371.553710938 43.2060546875 379.366210938 39.98828125 388.556640625 39.98828125 c 0 + 397.748046875 39.98828125 405.560546875 43.2060546875 411.995117188 49.6416015625 c 0 + 418.428710938 56.0703125 421.645507812 63.888671875 421.645507812 73.076171875 c 0 + 421.645507812 82.2705078125 418.428710938 90.08203125 411.995117188 96.51171875 c 2 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.73 +Encoding: 73 -1 40 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +123.8515625 455.4296875 m 2 + 115.579101562 455.4296875 107.766601562 456.961914062 100.413085938 460.025390625 c 0 + 93.3671875 463.088867188 87.2392578125 467.224609375 82.03125 472.43359375 c 0 + 76.8232421875 477.641601562 72.6875 483.768554688 69.623046875 490.815429688 c 0 + 66.5595703125 498.168945312 65.02734375 505.981445312 65.02734375 514.252929688 c 2 + 65.02734375 631.900390625 l 2 + 65.02734375 640.171875 66.5595703125 647.83203125 69.623046875 654.877929688 c 0 + 72.6875 661.924804688 76.8232421875 668.052734375 82.03125 673.260742188 c 0 + 87.5458984375 678.775390625 93.826171875 683.064453125 100.873046875 686.127929688 c 0 + 107.919921875 689.19140625 115.579101562 690.723632812 123.8515625 690.723632812 c 2 + 241.498046875 690.723632812 l 2 + 249.463867188 690.723632812 256.969726562 689.19140625 264.016601562 686.127929688 c 0 + 271.369140625 683.064453125 277.650390625 678.775390625 282.858398438 673.260742188 c 0 + 288.373046875 668.052734375 292.662109375 661.771484375 295.725585938 654.418945312 c 0 + 298.790039062 647.372070312 300.321289062 639.866210938 300.321289062 631.900390625 c 2 + 300.321289062 514.252929688 l 2 + 300.321289062 505.981445312 298.790039062 498.321289062 295.725585938 491.275390625 c 0 + 292.662109375 484.228515625 288.373046875 477.948242188 282.858398438 472.43359375 c 0 + 277.650390625 467.224609375 271.522460938 463.088867188 264.475585938 460.025390625 c 0 + 257.4296875 456.961914062 249.76953125 455.4296875 241.498046875 455.4296875 c 2 + 123.8515625 455.4296875 l 2 +123.8515625 631.900390625 m 1 + 123.8515625 514.252929688 l 1 + 241.498046875 514.252929688 l 1 + 241.498046875 631.900390625 l 1 + 123.8515625 631.900390625 l 1 +388.556640625 573.076171875 m 2 + 380.590820312 573.076171875 373.697265625 575.987304688 367.876953125 581.80859375 c 0 + 362.055664062 587.629882812 359.145507812 594.522460938 359.145507812 602.48828125 c 0 + 359.145507812 610.454101562 362.055664062 617.34765625 367.876953125 623.168945312 c 0 + 373.697265625 628.989257812 380.590820312 631.900390625 388.556640625 631.900390625 c 2 + 859.147460938 631.900390625 l 2 + 867.111328125 631.900390625 874.005859375 628.989257812 879.823242188 623.168945312 c 0 + 885.647460938 617.34765625 888.55859375 610.454101562 888.55859375 602.48828125 c 0 + 888.55859375 594.522460938 885.647460938 587.629882812 879.823242188 581.80859375 c 0 + 874.005859375 575.987304688 867.111328125 573.076171875 859.147460938 573.076171875 c 2 + 388.556640625 573.076171875 l 2 +123.8515625 161.311523438 m 2 + 115.579101562 161.311523438 107.766601562 162.840820312 100.413085938 165.90625 c 0 + 93.3671875 168.970703125 87.2392578125 173.10546875 82.03125 178.317382812 c 0 + 76.8232421875 183.5234375 72.6875 189.653320312 69.623046875 196.700195312 c 0 + 66.5595703125 204.052734375 65.02734375 211.86328125 65.02734375 220.135742188 c 2 + 65.02734375 337.782226562 l 2 + 65.02734375 346.0546875 66.5595703125 353.713867188 69.623046875 360.760742188 c 0 + 72.6875 367.806640625 76.8232421875 373.934570312 82.03125 379.142578125 c 0 + 87.5458984375 384.657226562 93.826171875 388.947265625 100.873046875 392.010742188 c 0 + 107.919921875 395.07421875 115.579101562 396.60546875 123.8515625 396.60546875 c 2 + 241.498046875 396.60546875 l 2 + 249.463867188 396.60546875 256.969726562 395.07421875 264.016601562 392.010742188 c 0 + 271.369140625 388.947265625 277.650390625 384.657226562 282.858398438 379.142578125 c 0 + 288.373046875 373.934570312 292.662109375 367.654296875 295.725585938 360.30078125 c 0 + 298.790039062 353.25390625 300.321289062 345.748046875 300.321289062 337.782226562 c 2 + 300.321289062 220.135742188 l 2 + 300.321289062 211.86328125 298.790039062 204.206054688 295.725585938 197.159179688 c 0 + 292.662109375 190.111328125 288.373046875 183.829101562 282.858398438 178.317382812 c 0 + 277.650390625 173.10546875 271.522460938 168.970703125 264.475585938 165.90625 c 0 + 257.4296875 162.840820312 249.76953125 161.311523438 241.498046875 161.311523438 c 2 + 123.8515625 161.311523438 l 2 +123.8515625 337.782226562 m 1 + 123.8515625 220.135742188 l 1 + 241.498046875 220.135742188 l 1 + 241.498046875 337.782226562 l 1 + 123.8515625 337.782226562 l 1 +388.556640625 278.958984375 m 2 + 380.590820312 278.958984375 373.697265625 281.869140625 367.876953125 287.690429688 c 0 + 362.055664062 293.51171875 359.145507812 300.405273438 359.145507812 308.370117188 c 0 + 359.145507812 316.336914062 362.055664062 323.23046875 367.876953125 329.05078125 c 0 + 373.697265625 334.872070312 380.590820312 337.782226562 388.556640625 337.782226562 c 2 + 472.196289062 337.782226562 l 1 + 461.473632812 329.204101562 451.209960938 320.012695312 441.40625 310.208984375 c 0 + 431.602539062 300.405273438 422.564453125 289.98828125 414.291992188 278.958984375 c 2 + 388.556640625 278.958984375 l 2 +123.8515625 -132.805664062 m 2 + 115.579101562 -132.805664062 107.766601562 -131.276367188 100.413085938 -128.211914062 c 0 + 93.3671875 -125.147460938 87.2392578125 -121.01171875 82.03125 -115.799804688 c 0 + 76.8232421875 -110.59375 72.6875 -104.46484375 69.623046875 -97.41796875 c 0 + 66.5595703125 -90.064453125 65.02734375 -82.2529296875 65.02734375 -73.982421875 c 2 + 65.02734375 43.6650390625 l 2 + 65.02734375 51.935546875 66.5595703125 59.59375 69.623046875 66.6416015625 c 0 + 72.6875 73.6884765625 76.8232421875 79.8173828125 82.03125 85.0234375 c 0 + 87.5458984375 90.541015625 93.826171875 94.8291015625 100.873046875 97.89453125 c 0 + 107.919921875 100.958984375 115.579101562 102.48828125 123.8515625 102.48828125 c 2 + 241.498046875 102.48828125 l 2 + 249.463867188 102.48828125 256.969726562 100.958984375 264.016601562 97.89453125 c 0 + 271.369140625 94.8291015625 277.650390625 90.541015625 282.858398438 85.0234375 c 0 + 288.373046875 79.8173828125 292.662109375 73.53515625 295.725585938 66.1826171875 c 0 + 298.790039062 59.1357421875 300.321289062 51.6298828125 300.321289062 43.6650390625 c 2 + 300.321289062 -73.982421875 l 2 + 300.321289062 -82.2529296875 298.790039062 -89.912109375 295.725585938 -96.958984375 c 0 + 292.662109375 -104.005859375 288.373046875 -110.288085938 282.858398438 -115.799804688 c 0 + 277.650390625 -121.01171875 271.522460938 -125.147460938 264.475585938 -128.211914062 c 0 + 257.4296875 -131.276367188 249.76953125 -132.805664062 241.498046875 -132.805664062 c 2 + 123.8515625 -132.805664062 l 2 +123.8515625 43.6650390625 m 1 + 123.8515625 -73.982421875 l 1 + 241.498046875 -73.982421875 l 1 + 241.498046875 43.6650390625 l 1 + 123.8515625 43.6650390625 l 1 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.74 +Encoding: 74 -1 41 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +417.96875 73.076171875 m 0 + 417.96875 109.53515625 424.862304688 143.846679688 438.6484375 176.017578125 c 0 + 452.7421875 208.188476562 471.737304688 236.219726562 495.633789062 260.1171875 c 0 + 519.53125 284.013671875 547.564453125 302.85546875 579.733398438 316.642578125 c 0 + 611.900390625 330.736328125 646.217773438 337.782226562 682.676757812 337.782226562 c 0 + 706.876953125 337.782226562 730.165039062 334.565429688 752.529296875 328.131835938 c 0 + 775.200195312 322.00390625 796.340820312 313.119140625 815.947265625 301.477539062 c 0 + 835.552734375 290.141601562 853.4765625 276.354492188 869.717773438 260.1171875 c 0 + 885.953125 243.879882812 899.741210938 225.956054688 911.076171875 206.346679688 c 0 + 922.717773438 186.741210938 931.599609375 165.599609375 937.729492188 142.9296875 c 0 + 944.165039062 120.564453125 947.3828125 97.2822265625 947.3828125 73.076171875 c 0 + 947.3828125 36.6171875 940.334960938 2.3056640625 926.241210938 -29.8642578125 c 0 + 912.453125 -62.03515625 893.611328125 -90.064453125 869.717773438 -113.96484375 c 0 + 845.817382812 -137.858398438 817.782226562 -156.858398438 785.6171875 -170.947265625 c 0 + 753.447265625 -184.735351562 719.135742188 -191.629882812 682.676757812 -191.629882812 c 0 + 645.912109375 -191.629882812 611.44140625 -184.735351562 579.274414062 -170.947265625 c 0 + 547.104492188 -157.165039062 519.071289062 -138.317382812 495.174804688 -114.423828125 c 0 + 471.27734375 -90.5234375 452.435546875 -62.494140625 438.6484375 -30.3232421875 c 0 + 424.862304688 1.8466796875 417.96875 36.3115234375 417.96875 73.076171875 c 0 +712.087890625 114.435546875 m 1 + 776.8828125 49.6416015625 l 2 + 783.317382812 43.2060546875 791.129882812 39.98828125 800.323242188 39.98828125 c 0 + 809.51171875 39.98828125 817.323242188 43.2060546875 823.758789062 49.6416015625 c 0 + 830.194335938 56.0703125 833.412109375 63.888671875 833.412109375 73.076171875 c 0 + 833.412109375 82.2705078125 830.194335938 90.08203125 823.758789062 96.51171875 c 2 + 706.111328125 214.161132812 l 2 + 699.676757812 220.595703125 691.864257812 223.811523438 682.676757812 223.811523438 c 0 + 673.482421875 223.811523438 665.670898438 220.595703125 659.235351562 214.161132812 c 2 + 541.58984375 96.51171875 l 2 + 535.15625 90.08203125 531.939453125 82.2705078125 531.939453125 73.076171875 c 0 + 531.939453125 63.888671875 535.15625 56.0703125 541.58984375 49.6416015625 c 0 + 548.024414062 43.2060546875 555.836914062 39.98828125 565.02734375 39.98828125 c 0 + 574.21875 39.98828125 582.03125 43.2060546875 588.46484375 49.6416015625 c 2 + 653.264648438 114.435546875 l 1 + 653.264648438 -44.5703125 l 2 + 653.264648438 -52.53515625 656.170898438 -59.4296875 661.994140625 -65.2529296875 c 0 + 667.817382812 -71.0703125 674.711914062 -73.982421875 682.676757812 -73.982421875 c 0 + 690.641601562 -73.982421875 697.53515625 -71.0703125 703.352539062 -65.2529296875 c 0 + 709.176757812 -59.4296875 712.087890625 -52.53515625 712.087890625 -44.5703125 c 2 + 712.087890625 114.435546875 l 1 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.75 +Encoding: 75 -1 42 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +770.912109375 631.900390625 m 2 + 182.674804688 631.900390625 l 2 + 150.1875 631.900390625 123.8515625 605.564453125 123.8515625 573.076171875 c 2 + 123.8515625 -15.1591796875 l 2 + 123.8515625 -47.6474609375 150.1875 -73.982421875 182.674804688 -73.982421875 c 2 + 770.912109375 -73.982421875 l 2 + 803.400390625 -73.982421875 829.735351562 -47.6474609375 829.735351562 -15.1591796875 c 2 + 829.735351562 573.076171875 l 2 + 829.735351562 605.564453125 803.400390625 631.900390625 770.912109375 631.900390625 c 2 +182.674804688 690.723632812 m 2 + 770.912109375 690.723632812 l 2 + 835.8828125 690.723632812 888.55859375 638.05078125 888.55859375 573.076171875 c 2 + 888.55859375 -15.1591796875 l 2 + 888.55859375 -80.1357421875 835.8828125 -132.805664062 770.912109375 -132.805664062 c 2 + 182.674804688 -132.805664062 l 2 + 117.700195312 -132.805664062 65.02734375 -80.1357421875 65.02734375 -15.1591796875 c 2 + 65.02734375 573.076171875 l 2 + 65.02734375 638.05078125 117.700195312 690.723632812 182.674804688 690.723632812 c 2 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.76 +Encoding: 76 -1 43 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +359.145507812 484.840820312 m 0 + 359.145507812 501.084960938 372.313476562 514.252929688 388.556640625 514.252929688 c 2 + 682.676757812 514.252929688 l 2 + 698.91796875 514.252929688 712.087890625 501.084960938 712.087890625 484.840820312 c 2 + 712.087890625 190.723632812 l 2 + 712.087890625 174.482421875 698.91796875 161.311523438 682.676757812 161.311523438 c 0 + 666.4296875 161.311523438 653.264648438 174.482421875 653.264648438 190.723632812 c 2 + 653.264648438 413.834960938 l 1 + 291.70703125 52.2822265625 l 2 + 280.220703125 40.7939453125 261.598632812 40.7939453125 250.11328125 52.2822265625 c 0 + 238.626953125 63.7646484375 238.626953125 82.388671875 250.11328125 93.876953125 c 2 + 611.670898438 455.4296875 l 1 + 388.556640625 455.4296875 l 2 + 372.313476562 455.4296875 359.145507812 468.59765625 359.145507812 484.840820312 c 0 +EndSplineSet +Validated: 33 +EndChar + +StartChar: NameMe.77 +Encoding: 77 -1 44 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +156.25 800 m 2 + 265.625 800 l 2 + 334.478515625 800 399.313476562 767.58203125 440.625 712.5 c 2 + 468.75 675 l 1 + 843.75 675 l 2 + 930.043945312 675 1000 605.043945312 1000 518.75 c 2 + 1000 278.89453125 l 1 + 992.34375 289.79296875 977.568359375 306.739257812 968.8125 316.559570312 c 0 + 964.181640625 321.75390625 959.9375 327.26953125 956.200195312 333.139648438 c 2 + 954.293945312 336.1328125 l 2 + 943.325195312 353.352539062 937.5 373.344726562 937.5 393.76171875 c 1 + 937.5 393.76171875 l 1 + 937.494140625 445.532226562 895.525390625 487.5 843.75 487.5 c 2 + 812.5 487.5 l 1 + 477.190429688 487.5 l 2 + 467.916015625 487.5 459.12109375 483.380859375 453.18359375 476.255859375 c 2 + 410.469726562 425 l 1 + 156.25 425 l 2 + 115.430664062 425 75.3701171875 398.912109375 62.5 362.5 c 2 + 62.5 -12.025390625 l 1 + 64.396484375 -35.119140625 l 2 + 66.5380859375 -61.193359375 69.955078125 -88.78125 87.85546875 -107.869140625 c 0 + 104.958984375 -126.106445312 129.2734375 -137.5 156.25 -137.5 c 2 + 453.583984375 -137.5 l 2 + 460.528320312 -145.918945312 467.899414062 -154.037109375 475.681640625 -161.818359375 c 0 + 489.790039062 -175.924804688 504.999023438 -188.681640625 521.10546875 -200 c 1 + 156.25 -200 l 2 + 69.9560546875 -200 0 -130.043945312 0 -43.75 c 2 + 0 643.75 l 2 + 0 730.043945312 69.9560546875 800 156.25 800 c 2 +843.75 612.5 m 2 + 437.5 612.5 l 1 + 390.625 675 l 2 + 361.116210938 714.344726562 314.805664062 737.5 265.625 737.5 c 2 + 156.25 737.5 l 2 + 104.47265625 737.5 62.5 695.52734375 62.5 643.75 c 2 + 62.5 456.26171875 l 1 + 88.6142578125 475.876953125 121.075195312 487.5 156.25 487.5 c 2 + 381.197265625 487.5 l 1 + 405.168945312 516.267578125 l 2 + 422.981445312 537.641601562 449.3671875 550 477.190429688 550 c 2 + 843.75 550 l 2 + 878.924804688 550 911.387695312 538.375976562 937.5 518.76171875 c 1 + 937.494140625 570.532226562 895.525390625 612.5 843.75 612.5 c 2 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.78 +Encoding: 78 -1 45 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +917.625 -117.625 m 0 + 864.880859375 -170.369140625 793.34375 -200 718.75 -200 c 0 + 644.15625 -200 572.62109375 -170.369140625 519.875976562 -117.625 c 0 + 467.131835938 -64.880859375 437.5 6.65625 437.5 81.25 c 0 + 437.5 155.84375 467.131835938 227.37890625 519.875976562 280.124023438 c 0 + 572.62109375 332.868164062 644.15625 362.5 718.75 362.5 c 0 + 793.34375 362.5 864.880859375 332.868164062 917.625 280.124023438 c 0 + 970.369140625 227.37890625 1000 155.84375 1000 81.25 c 0 + 1000 6.65625 970.369140625 -64.880859375 917.625 -117.625 c 0 +740.849609375 228.346679688 m 2 + 728.643554688 240.55078125 708.856445312 240.55078125 696.650390625 228.346679688 c 0 + 684.450195312 216.143554688 684.450195312 196.356445312 696.650390625 184.153320312 c 2 + 768.306640625 112.5 l 1 + 593.75 112.5 l 2 + 576.491210938 112.5 562.5 98.505859375 562.5 81.25 c 0 + 562.5 63.994140625 576.491210938 50 593.75 50 c 2 + 768.306640625 50 l 1 + 696.650390625 -21.650390625 l 2 + 684.450195312 -33.8564453125 684.450195312 -53.6435546875 696.650390625 -65.849609375 c 0 + 708.856445312 -78.0498046875 728.643554688 -78.0498046875 740.849609375 -65.849609375 c 2 + 865.849609375 59.150390625 l 2 + 878.049804688 71.3564453125 878.049804688 91.1435546875 865.849609375 103.349609375 c 2 + 740.849609375 228.346679688 l 2 +EndSplineSet +Validated: 33 +EndChar + +StartChar: NameMe.79 +Encoding: 79 -1 46 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +161.62109375 512.889648438 m 0 + 169.474609375 520.743164062 178.100585938 527.436523438 187.5 532.969726562 c 1 + 187.5 112.5 l 2 + 187.5 103.712890625 189.127929688 95.412109375 192.3828125 87.599609375 c 0 + 195.637695312 80.1123046875 200.032226562 73.599609375 205.56640625 68.068359375 c 0 + 211.099609375 62.53125 217.610351562 58.1376953125 225.09765625 54.880859375 c 0 + 232.91015625 51.625 241.2109375 50 250 50 c 2 + 750 50 l 1 + 750.318359375 50 l 1 + 857.96875 50 l 1 + 852.4375 40.599609375 845.744140625 31.974609375 837.887695312 24.119140625 c 0 + 826.825195312 13.0498046875 813.799804688 4.099609375 798.825195312 -2.7373046875 c 0 + 784.181640625 -9.244140625 768.71875 -12.5 752.443359375 -12.5 c 2 + 247.55859375 -12.5 l 2 + 231.282226562 -12.5 215.657226562 -9.244140625 200.68359375 -2.7373046875 c 0 + 186.03515625 4.099609375 173.014648438 13.0498046875 161.62109375 24.119140625 c 0 + 150.552734375 35.5126953125 141.6015625 48.537109375 134.765625 63.181640625 c 0 + 128.254882812 78.15625 125 93.78125 125 110.056640625 c 2 + 125 427.440429688 l 2 + 125 443.716796875 128.254882812 459.178710938 134.765625 473.827148438 c 0 + 141.6015625 488.80078125 150.552734375 501.822265625 161.62109375 512.889648438 c 0 +218.75 -137.5 m 2 + 188.4765625 -137.5 159.994140625 -131.806640625 133.30078125 -120.412109375 c 0 + 106.93359375 -109.018554688 83.822265625 -93.3935546875 63.96484375 -73.537109375 c 0 + 44.1083984375 -53.681640625 28.4833984375 -30.568359375 17.08984375 -4.2001953125 c 0 + 5.6962890625 22.494140625 0 50.974609375 0 81.25 c 2 + 0 299.999023438 l 2 + 0 322.459960938 5.5341796875 343.130859375 16.6015625 362.01171875 c 0 + 27.9951171875 380.891601562 43.2939453125 396.028320312 62.5 407.420898438 c 1 + 62.5 81.25 l 2 + 62.5 59.7626953125 66.568359375 39.4189453125 74.70703125 20.212890625 c 0 + 82.8447265625 1.3310546875 93.912109375 -15.2685546875 107.91015625 -29.587890625 c 0 + 122.233398438 -43.587890625 138.833984375 -54.65625 157.71484375 -62.7939453125 c 0 + 176.920898438 -70.931640625 197.265625 -75 218.75 -75 c 2 + 732.424804688 -75 l 1 + 721.03125 -94.2060546875 705.893554688 -109.505859375 687.012695312 -120.900390625 c 0 + 668.130859375 -131.96875 647.462890625 -137.5 625 -137.5 c 2 + 218.75 -137.5 l 2 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.80 +Encoding: 80 -1 47 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +296.447265625 733.525390625 m 0 + 303.690429688 729.505859375 309.040039062 722.775390625 311.322265625 714.8125 c 2 + 436.322265625 277.3125 l 2 + 438.59375 269.33984375 437.604492188 260.791015625 433.572265625 253.546875 c 0 + 429.540039062 246.303710938 422.795898438 240.958007812 414.822265625 238.6875 c 0 + 406.849609375 236.416992188 398.30078125 237.40625 391.057617188 241.438476562 c 0 + 383.813476562 245.469726562 378.46875 252.21484375 376.197265625 260.1875 c 2 + 251.197265625 697.6875 l 2 + 250.072265625 701.635742188 249.735351562 705.766601562 250.20703125 709.844726562 c 0 + 250.677734375 713.922851562 251.94921875 717.8671875 253.9453125 721.454101562 c 0 + 255.94140625 725.041015625 258.625976562 728.200195312 261.842773438 730.749023438 c 0 + 265.060546875 733.298828125 268.749023438 735.188476562 272.697265625 736.3125 c 1 + 272.697265625 736.25 l 1 + 280.662109375 738.525390625 289.204101562 737.545898438 296.447265625 733.525390625 c 0 +483.947265625 733.525390625 m 0 + 491.190429688 729.505859375 496.540039062 722.775390625 498.822265625 714.8125 c 2 + 623.822265625 277.3125 l 2 + 626.09375 269.33984375 625.106445312 260.791015625 621.072265625 253.546875 c 0 + 617.040039062 246.303710938 610.295898438 240.958007812 602.322265625 238.6875 c 0 + 594.349609375 236.416992188 585.80078125 237.40625 578.557617188 241.438476562 c 0 + 571.313476562 245.469726562 565.96875 252.21484375 563.697265625 260.1875 c 2 + 438.697265625 697.6875 l 2 + 437.572265625 701.635742188 437.235351562 705.766601562 437.70703125 709.844726562 c 0 + 438.177734375 713.922851562 439.44921875 717.8671875 441.4453125 721.454101562 c 0 + 443.44140625 725.041015625 446.125976562 728.200195312 449.342773438 730.749023438 c 0 + 452.560546875 733.298828125 456.249023438 735.188476562 460.197265625 736.3125 c 1 + 460.197265625 736.25 l 1 + 468.162109375 738.525390625 476.704101562 737.545898438 483.947265625 733.525390625 c 0 +798.78125 251.229492188 m 0 + 789.987304688 242.438476562 778.0625 237.5 765.630859375 237.5 c 0 + 753.200195312 237.5 741.275390625 242.438476562 732.487304688 251.229492188 c 0 + 723.693359375 260.01953125 718.755859375 271.943359375 718.755859375 284.375 c 0 + 718.755859375 296.806640625 723.693359375 308.73046875 732.487304688 317.520507812 c 0 + 741.275390625 326.311523438 753.200195312 331.25 765.630859375 331.25 c 0 + 778.0625 331.25 789.987304688 326.311523438 798.78125 317.520507812 c 0 + 807.568359375 308.73046875 812.505859375 296.806640625 812.505859375 284.375 c 0 + 812.505859375 271.943359375 807.568359375 260.01953125 798.78125 251.229492188 c 0 +955.03125 251.229492188 m 0 + 946.237304688 242.438476562 934.3125 237.5 921.880859375 237.5 c 0 + 909.450195312 237.5 897.525390625 242.438476562 888.737304688 251.229492188 c 0 + 879.943359375 260.01953125 875.005859375 271.943359375 875.005859375 284.375 c 0 + 875.005859375 296.806640625 879.943359375 308.73046875 888.737304688 317.520507812 c 0 + 897.525390625 326.311523438 909.450195312 331.25 921.880859375 331.25 c 0 + 934.3125 331.25 946.237304688 326.311523438 955.03125 317.520507812 c 0 + 963.818359375 308.73046875 968.755859375 296.806640625 968.755859375 284.375 c 0 + 968.755859375 271.943359375 963.818359375 260.01953125 955.03125 251.229492188 c 0 +EndSplineSet +Validated: 1 +EndChar + +StartChar: NameMe.81 +Encoding: 81 -1 48 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +500 -137.5 m 0 + 741.625 -137.5 937.5 58.375 937.5 300 c 0 + 937.5 541.624023438 741.625 737.5 500 737.5 c 0 + 258.375976562 737.5 62.5 541.624023438 62.5 300 c 0 + 62.5 58.375 258.375976562 -137.5 500 -137.5 c 0 +62.5 300 m 0 + 62.5 58.375 258.375 -137.5 500 -137.5 c 0 + 741.625 -137.5 937.5 58.375 937.5 300 c 0 + 937.5 541.625 741.625 737.5 500 737.5 c 0 + 258.375 737.5 62.5 541.625 62.5 300 c 0 +EndSplineSet +Validated: 5 +EndChar + +StartChar: NameMe.82 +Encoding: 82 -1 49 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +255.333984375 675 m 2 + 156.25 675 l 2 + 140.0703125 675 126.76171875 662.703125 125.161132812 646.9453125 c 0 + 125.0546875 645.89453125 125 644.829101562 125 643.75 c 2 + 125 -106.25 l 2 + 125 -123.505859375 138.991210938 -137.5 156.25 -137.5 c 2 + 378.125976562 -137.5 l 1 + 376.076171875 -127.400390625 375 -116.950195312 375 -106.25 c 2 + 375 393.75 l 2 + 375 480.043945312 444.956054688 550 531.25 550 c 2 + 750 550 l 1 + 750 643.75 l 2 + 750 661.008789062 736.005859375 675 718.75 675 c 2 + 619.666015625 675 l 2 + 606.795898438 638.587890625 572.069335938 612.5 531.25 612.5 c 2 + 343.75 612.5 l 2 + 302.930664062 612.5 268.204101562 638.587890625 255.333984375 675 c 2 +562.5 706.25 m 0 + 562.5 723.508789062 548.508789062 737.5 531.25 737.5 c 2 + 343.75 737.5 l 2 + 326.491210938 737.5 312.5 723.508789062 312.5 706.25 c 0 + 312.5 688.991210938 326.491210938 675 343.75 675 c 2 + 531.25 675 l 2 + 548.508789062 675 562.5 688.991210938 562.5 706.25 c 0 +312.5 706.25 m 0 + 312.5 688.991210938 326.491210938 675 343.75 675 c 2 + 531.25 675 l 2 + 548.508789062 675 562.5 688.991210938 562.5 706.25 c 0 + 562.5 723.508789062 548.508789062 737.5 531.25 737.5 c 2 + 343.75 737.5 l 2 + 326.491210938 737.5 312.5 723.508789062 312.5 706.25 c 0 +EndSplineSet +Validated: 5 +EndChar + +StartChar: NameMe.83 +Encoding: 83 -1 50 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +160.0625 612.5 m 1 + 240.25 -82.1875 l 2 + 242.012695312 -97.412109375 249.30859375 -111.462890625 260.750976562 -121.65625 c 0 + 272.193359375 -131.856445312 286.985351562 -137.494140625 302.3125 -137.5 c 2 + 697.6875 -137.5 l 2 + 713.012695312 -137.494140625 727.806640625 -131.856445312 739.25 -121.65625 c 0 + 750.693359375 -111.462890625 757.987304688 -97.412109375 759.75 -82.1875 c 2 + 839.875 612.5 l 1 + 160.0625 612.5 l 1 +EndSplineSet +Validated: 9 +EndChar + +StartChar: NameMe.84 +Encoding: 84 -1 51 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +406.25 612.5 m 1 + 156.25 612.5 l 2 + 104.47265625 612.5 62.5 570.52734375 62.5 518.75 c 2 + 62.5 81.25 l 2 + 62.5 29.474609375 104.47265625 -12.5 156.25 -12.5 c 2 + 406.25 -12.5 l 1025 +593.75 -12.5 m 1 + 843.75 -12.5 l 2 + 895.525390625 -12.5 937.5 29.474609375 937.5 81.25 c 2 + 937.5 518.75 l 2 + 937.5 570.52734375 895.525390625 612.5 843.75 612.5 c 2 + 593.75 612.5 l 1025 +406.25 612.5 m 1 + 156.25 612.5 l 2 + 104.47265625 612.5 62.5 570.52734375 62.5 518.75 c 2 + 62.5 81.25 l 2 + 62.5 29.474609375 104.47265625 -12.5 156.25 -12.5 c 2 + 406.25 -12.5 l 1 + 406.25 612.5 l 1 +593.75 -12.5 m 1 + 843.75 -12.5 l 2 + 895.525390625 -12.5 937.5 29.474609375 937.5 81.25 c 2 + 937.5 518.75 l 2 + 937.5 570.52734375 895.525390625 612.5 843.75 612.5 c 2 + 593.75 612.5 l 1 + 593.75 -12.5 l 1 +EndSplineSet +Validated: 11 +EndChar + +StartChar: NameMe.85 +Encoding: 85 -1 52 +Width: 1000 +Flags: HW +LayerCount: 2 +Fore +SplineSet +375 112.5 m 1 + 375 18.75 l 2 + 375 -33.025390625 416.97265625 -75 468.75 -75 c 2 + 781.25 -75 l 2 + 833.025390625 -75 875 -33.025390625 875 18.75 c 2 + 875 331.25 l 2 + 875 383.02734375 833.025390625 425 781.25 425 c 2 + 687.5 425 l 1025 +375 112.5 m 1 + 375 18.75 l 2 + 375 -33.025390625 416.97265625 -75 468.75 -75 c 2 + 781.25 -75 l 2 + 833.025390625 -75 875 -33.025390625 875 18.75 c 2 + 875 331.25 l 2 + 875 383.02734375 833.025390625 425 781.25 425 c 2 + 687.5 425 l 1 + 687.5 268.75 l 2 + 687.5 182.456054688 617.543945312 112.5 531.25 112.5 c 2 + 375 112.5 l 1 +475.145507812 574.854492188 m 2 + 497.219726562 596.928710938 535.15625 581.125 535.15625 550 c 0 + 535.15625 540.298828125 531.217773438 531.509765625 524.854492188 525.145507812 c 2 + 306.104492188 306.395507812 l 2 + 292.369140625 292.66015625 270.130859375 292.66015625 256.395507812 306.395507812 c 2 + 162.645507812 400.145507812 l 2 + 140.571289062 422.219726562 156.375 460.15625 187.5 460.15625 c 0 + 197.201171875 460.15625 205.990234375 456.217773438 212.354492188 449.854492188 c 2 + 281.25 380.958984375 l 1 + 475.145507812 574.854492188 l 2 +EndSplineSet +Validated: 524331 +EndChar + +StartChar: NameMe.86 +Encoding: 86 -1 53 +Width: 1000 +Flags: H +LayerCount: 2 +Fore +SplineSet +500 425 m 1 + 125 425 l 1 + 125 50 l 2 + 125 -19.037109375 180.96484375 -75 250 -75 c 2 + 500 -75 l 1 + 500 425 l 1 +500 425 m 1 + 125 425 l 1 + 125 50 l 2 + 125 -19.037109375 180.96484375 -75 250 -75 c 2 + 500 -75 l 1025 +EndSplineSet EndChar EndChars EndSplineFont diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index 7b02bb4e8112..09c9baeca77d 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -4,8 +4,8 @@ using Files.App.Filesystem; using Files.App.Interacts; using Files.App.ViewModels; -using Files.Backend.Services; using Files.Backend.Helpers; +using Files.Backend.Services; using Files.Backend.Services.Settings; using Files.Shared.Enums; using Microsoft.UI.Xaml.Input; @@ -19,7 +19,6 @@ using Windows.ApplicationModel.DataTransfer; using Windows.Storage; using Windows.System; -using Files.App.ServicesImplementation.Settings; namespace Files.App.Helpers { @@ -524,11 +523,11 @@ public static List GetBaseLayoutMenuItems(Curren { Text = "BaseLayoutContextFlyoutPaste/Text".GetLocalizedResource(), IsPrimary = true, - // Glyph = "\uF16D", ShowInFtpPage = true, ShowInZipPage = true, ColoredIcon = new ColoredIconModel() { + BaseBackdropGlyph = "\uF052", BaseLayerGlyph = "\uF023", OverlayLayerGlyph = "\uF024", }, @@ -552,6 +551,7 @@ public static List GetBaseLayoutMenuItems(Curren Text = "BaseLayoutContextFlyoutNew/Label".GetLocalizedResource(), ColoredIcon = new ColoredIconModel() { + BaseBackdropGlyph = "\uF051", BaseLayerGlyph = "\uF037", OverlayLayerGlyph = "\uF038" }, @@ -679,7 +679,11 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "Open".GetLocalizedResource(), - Glyph = "\uE8E5", + ColoredIcon = new ColoredIconModel() + { + BaseLayerGlyph = "\uF047", + OverlayLayerGlyph = "\uF048", + }, Command = commandsViewModel.OpenItemCommand, ShowInSearchPage = true, ShowInFtpPage = true, @@ -689,7 +693,11 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutOpenItemWith/Text".GetLocalizedResource(), - Glyph = "\uE17D", + ColoredIcon = new ColoredIconModel() + { + BaseLayerGlyph = "\uF049", + OverlayLayerGlyph = "\uF04A", + }, Command = commandsViewModel.OpenItemWithApplicationPickerCommand, Tag = "OpenWith", CollapseLabel = true, @@ -699,7 +707,11 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutOpenItemWith/Text".GetLocalizedResource(), - Glyph = "\uE17D", + ColoredIcon = new ColoredIconModel() + { + BaseLayerGlyph = "\uF049", + OverlayLayerGlyph = "\uF04A", + }, Tag = "OpenWithOverflow", IsHidden = true, CollapseLabel = true, @@ -745,8 +757,12 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "OpenInNewPane".GetLocalizedResource(), - Glyph = "\xF117", - GlyphFontFamilyName = "CustomGlyph", + ColoredIcon = new ColoredIconModel() + { + BaseBackdropGlyph = "\uF056", + BaseLayerGlyph = "\uF03B", + OverlayLayerGlyph = "\uF03C", + }, Command = commandsViewModel.OpenDirectoryInNewPaneCommand, ShowItem = userSettingsService.PreferencesSettingsService.ShowOpenInNewPane && areAllItemsFolders, SingleItemOnly = true, @@ -860,8 +876,8 @@ public static List GetBaseItemMenuItems(BaseLayo Text = "CopyLocation".GetLocalizedResource(), ColoredIcon = new ColoredIconModel() { - BaseLayerGlyph = "\uF02F", - OverlayLayerGlyph = "\uF030" + BaseLayerGlyph = "\uF04F", + OverlayLayerGlyph = "\uF050" }, Command = commandsViewModel.CopyPathOfSelectedItemCommand, SingleItemOnly = true, @@ -876,6 +892,7 @@ public static List GetBaseItemMenuItems(BaseLayo IsPrimary = true, ColoredIcon = new ColoredIconModel() { + BaseBackdropGlyph = "\uF052", BaseLayerGlyph = "\uF023", OverlayLayerGlyph = "\uF024", }, @@ -906,8 +923,11 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutShortcut/Text".GetLocalizedResource(), - Glyph = "\uF10A", - GlyphFontFamilyName = "CustomGlyph", + ColoredIcon = new ColoredIconModel() + { + BaseLayerGlyph = "\uF04B", + OverlayLayerGlyph = "\uF04C" + }, Command = commandsViewModel.CreateShortcutCommand, ShowItem = !selectedItems.FirstOrDefault()?.IsShortcut ?? false, SingleItemOnly = true, @@ -916,10 +936,10 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutRename/Text".GetLocalizedResource(), - //Glyph = "\uF8AC", IsPrimary = true, ColoredIcon = new ColoredIconModel() { + BaseBackdropGlyph = "\uF054", BaseLayerGlyph = "\uF027", OverlayLayerGlyph = "\uF028", }, @@ -937,7 +957,6 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutShare/Text".GetLocalizedResource(), - //Glyph = "\uF72D", IsPrimary = true, ColoredIcon = new ColoredIconModel() { @@ -950,10 +969,10 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "Delete".GetLocalizedResource(), - //Glyph = "\uF74D", IsPrimary = true, ColoredIcon = new ColoredIconModel() { + BaseBackdropGlyph = "\uF053", BaseLayerGlyph = "\uF035", OverlayLayerGlyph = "\uF036" }, @@ -971,7 +990,6 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutProperties/Text".GetLocalizedResource(), - //Glyph = "\uF946", IsPrimary = true, ColoredIcon = new ColoredIconModel() { diff --git a/src/Files.App/UserControls/ColoredIcon.xaml b/src/Files.App/UserControls/ColoredIcon.xaml index 5c34b47a0143..c49a4b04f55c 100644 --- a/src/Files.App/UserControls/ColoredIcon.xaml +++ b/src/Files.App/UserControls/ColoredIcon.xaml @@ -31,22 +31,29 @@ - + @@ -57,14 +64,16 @@ + + - + \ No newline at end of file diff --git a/src/Files.App/UserControls/ColoredIcon.xaml.cs b/src/Files.App/UserControls/ColoredIcon.xaml.cs index 1d75821ba512..52db6caa7b7e 100644 --- a/src/Files.App/UserControls/ColoredIcon.xaml.cs +++ b/src/Files.App/UserControls/ColoredIcon.xaml.cs @@ -8,6 +8,12 @@ namespace Files.App.UserControls { public sealed partial class ColoredIcon : UserControl { + public string BaseBackdropGlyph + { + get => (string)GetValue(BaseBackdropPathProperty); + set => SetValue(BaseBackdropPathProperty, value); + } + public string BaseLayerGlyph { get => (string)GetValue(BaseLayerPathProperty); @@ -20,6 +26,10 @@ public string OverlayLayerGlyph set => SetValue(OverlayLayerPathProperty, value); } + // Using a DependencyProperty as the backing store for BaseBackdropPath. This enables animation, styling, binding, etc... + public static readonly DependencyProperty BaseBackdropPathProperty = + DependencyProperty.Register(nameof(BaseBackdropGlyph), typeof(string), typeof(ColoredIcon), new PropertyMetadata(null)); + // Using a DependencyProperty as the backing store for OverlayLayerPath. This enables animation, styling, binding, etc... public static readonly DependencyProperty OverlayLayerPathProperty = DependencyProperty.Register(nameof(OverlayLayerGlyph), typeof(string), typeof(ColoredIcon), new PropertyMetadata(null)); diff --git a/src/Files.App/UserControls/InnerNavigationToolbar.xaml b/src/Files.App/UserControls/InnerNavigationToolbar.xaml index ce4745542d1c..c8ee2aad1680 100644 --- a/src/Files.App/UserControls/InnerNavigationToolbar.xaml +++ b/src/Files.App/UserControls/InnerNavigationToolbar.xaml @@ -100,6 +100,7 @@ @@ -148,7 +149,10 @@ IsEnabled="False" Modifiers="Control" /> - + - + - + - + - + - + diff --git a/src/Files.App/ViewModels/ContextMenuFlyoutItemViewModel.cs b/src/Files.App/ViewModels/ContextMenuFlyoutItemViewModel.cs index 12bd472ae1b1..91f0118ed519 100644 --- a/src/Files.App/ViewModels/ContextMenuFlyoutItemViewModel.cs +++ b/src/Files.App/ViewModels/ContextMenuFlyoutItemViewModel.cs @@ -98,10 +98,13 @@ public struct ColoredIconModel public string BaseLayerGlyph { get; set; } + public string BaseBackdropGlyph { get; set; } + public ColoredIcon ToColoredIcon() => new() { OverlayLayerGlyph = OverlayLayerGlyph, BaseLayerGlyph = BaseLayerGlyph, + BaseBackdropGlyph = BaseBackdropGlyph, }; public bool IsValid => !string.IsNullOrEmpty(BaseLayerGlyph); From 65834fc9ff392af000eb4bd3397093aa01dcdd27 Mon Sep 17 00:00:00 2001 From: Filippo Ferrario <102259289+ferrariofilippo@users.noreply.github.com> Date: Wed, 15 Feb 2023 21:56:38 +0100 Subject: [PATCH 5/5] Fix: Remove deleted tags from items (#11309) --- .../Settings/FileTagsSettingsService.cs | 19 ++++++++++++++++++- src/Files.App/ViewModels/ItemViewModel.cs | 8 +++++--- .../LayoutModes/DetailsLayoutBrowser.xaml.cs | 4 +--- .../Views/SettingsPages/Advanced.xaml.cs | 8 ++++---- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Files.App/ServicesImplementation/Settings/FileTagsSettingsService.cs b/src/Files.App/ServicesImplementation/Settings/FileTagsSettingsService.cs index d692b7c02c10..07cb0fa9548b 100644 --- a/src/Files.App/ServicesImplementation/Settings/FileTagsSettingsService.cs +++ b/src/Files.App/ServicesImplementation/Settings/FileTagsSettingsService.cs @@ -1,5 +1,5 @@ using Files.App.Extensions; -using Files.App.Helpers; +using Files.App.Filesystem; using Files.App.Serialization; using Files.App.Serialization.Implementation; using Files.Backend.Services.Settings; @@ -114,6 +114,8 @@ public void DeleteTag(string uid) var oldTags = FileTagList.ToList(); oldTags.RemoveAt(index); FileTagList = oldTags; + UntagAllFiles(uid); + OnTagsUpdated.Invoke(this, EventArgs.Empty); } @@ -163,5 +165,20 @@ public override object ExportSettings() return (tag, index); } + + private void UntagAllFiles(string uid) + { + var tagDoDelete = new string [] { uid }; + + foreach (var item in FileTagsHelper.GetDbInstance().GetAll()) + { + if (item.Tags.Contains(uid)) + { + FileTagsHelper.WriteFileTag( + item.FilePath, + item.Tags.Except(tagDoDelete).ToArray()); + } + } + } } } diff --git a/src/Files.App/ViewModels/ItemViewModel.cs b/src/Files.App/ViewModels/ItemViewModel.cs index 265d415578f0..cc87a41d00bc 100644 --- a/src/Files.App/ViewModels/ItemViewModel.cs +++ b/src/Files.App/ViewModels/ItemViewModel.cs @@ -376,7 +376,8 @@ public ItemViewModel(FolderSettingsViewModel folderSettingsViewModel) dispatcherQueue = DispatcherQueue.GetForCurrentThread(); UserSettingsService.OnSettingChangedEvent += UserSettingsService_OnSettingChangedEvent; - fileTagsSettingsService.OnSettingImportedEvent += FileTagsSettingsService_OnSettingImportedEvent; + fileTagsSettingsService.OnSettingImportedEvent += FileTagsSettingsService_OnSettingUpdated; + fileTagsSettingsService.OnTagsUpdated += FileTagsSettingsService_OnSettingUpdated; folderSizeProvider.SizeChanged += FolderSizeProvider_SizeChanged; RecycleBinManager.Default.RecycleBinItemCreated += RecycleBinItemCreated; RecycleBinManager.Default.RecycleBinItemDeleted += RecycleBinItemDeleted; @@ -473,7 +474,7 @@ await dispatcherQueue.EnqueueAsync(() => } } - private async void FileTagsSettingsService_OnSettingImportedEvent(object? sender, EventArgs e) + private async void FileTagsSettingsService_OnSettingUpdated(object? sender, EventArgs e) { await dispatcherQueue.EnqueueAsync(() => { @@ -2281,7 +2282,8 @@ public void Dispose() RecycleBinManager.Default.RecycleBinItemDeleted -= RecycleBinItemDeleted; RecycleBinManager.Default.RecycleBinRefreshRequested -= RecycleBinRefreshRequested; UserSettingsService.OnSettingChangedEvent -= UserSettingsService_OnSettingChangedEvent; - fileTagsSettingsService.OnSettingImportedEvent -= FileTagsSettingsService_OnSettingImportedEvent; + fileTagsSettingsService.OnSettingImportedEvent -= FileTagsSettingsService_OnSettingUpdated; + fileTagsSettingsService.OnTagsUpdated -= FileTagsSettingsService_OnSettingUpdated; folderSizeProvider.SizeChanged -= FolderSizeProvider_SizeChanged; DefaultIcons.Clear(); } diff --git a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs index 2f5ad39e0dbe..e0e469d96e6c 100644 --- a/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs +++ b/src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs @@ -40,8 +40,6 @@ public sealed partial class DetailsLayoutBrowser : StandardViewBase private ListedItem? _nextItemToSelect; - private IFileTagsSettingsService tagsSettingsService { get; } = Ioc.Default.GetRequiredService(); - protected override uint IconSize => currentIconSize; protected override ListViewBase ListViewBase => FileList; @@ -757,7 +755,7 @@ private void TagIcon_Tapped(object sender, TappedRoutedEventArgs e) if (tagName is null || parent?.DataContext is not ListedItem item) return; - var tagId = tagsSettingsService.GetTagsByName(tagName).FirstOrDefault()?.Uid; + var tagId = FileTagsSettingsService.GetTagsByName(tagName).FirstOrDefault()?.Uid; item.FileTags = item.FileTags .Except(new string[] { tagId }) diff --git a/src/Files.App/Views/SettingsPages/Advanced.xaml.cs b/src/Files.App/Views/SettingsPages/Advanced.xaml.cs index 6734409ecde6..9aa754418e12 100644 --- a/src/Files.App/Views/SettingsPages/Advanced.xaml.cs +++ b/src/Files.App/Views/SettingsPages/Advanced.xaml.cs @@ -100,16 +100,16 @@ private void NewTagTextBox_TextChanged(object sender, TextChangedEventArgs e) private bool IsNameValid(string name) { return !( - string.IsNullOrWhiteSpace(name) || - name.StartsWith('.') || - name.EndsWith('.') || + string.IsNullOrWhiteSpace(name) || + name.StartsWith('.') || + name.EndsWith('.') || ViewModel.Tags.Any(tag => name == tag.Tag.Name) ); } private void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args) { - if (args.KeyboardAccelerator.Key is VirtualKey.Escape) + if (args.KeyboardAccelerator.Key is VirtualKey.Escape && editingTag is not null) { CloseEdit(); args.Handled = true;