From f14e289a961c74fef105cbadcbcf5a724e1e9159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= Date: Thu, 16 Feb 2023 20:55:43 +0100 Subject: [PATCH 1/8] Add send to menu option to main menu --- src/Files.App/BaseLayout.cs | 23 ++++++++++++++-- .../Helpers/ContextFlyoutItemHelper.cs | 26 +++++++++++++++++++ .../Helpers/ShellContextMenuHelper.cs | 20 +++++++++++--- src/Files.App/Strings/en-US/Resources.resw | 3 +++ 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/Files.App/BaseLayout.cs b/src/Files.App/BaseLayout.cs index 0d334059557f..737e1fb74e24 100644 --- a/src/Files.App/BaseLayout.cs +++ b/src/Files.App/BaseLayout.cs @@ -713,11 +713,12 @@ private void AddNewFileTagsToMenu(CommandBarFlyout contextMenu) private void AddShellItemsToMenu(List shellMenuItems, CommandBarFlyout contextMenuFlyout, bool shiftPressed) { var openWithSubItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(ShellContextmenuHelper.GetOpenWithItems(shellMenuItems)); + var sendToSubItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(ShellContextmenuHelper.GetSendToItems(shellMenuItems)); var mainShellMenuItems = shellMenuItems.RemoveFrom(!UserSettingsService.PreferencesSettingsService.MoveShellExtensionsToSubMenu ? int.MaxValue : shiftPressed ? 6 : 0); var overflowShellMenuItemsUnfiltered = shellMenuItems.Except(mainShellMenuItems).ToList(); var overflowShellMenuItems = overflowShellMenuItemsUnfiltered.Where( - (x, i) => (x.ItemType == ItemType.Separator && - overflowShellMenuItemsUnfiltered[i + 1 < overflowShellMenuItemsUnfiltered.Count ? i + 1 : i].ItemType == ItemType.Separator) + (x, i) => (x.ItemType == ItemType.Separator && + overflowShellMenuItemsUnfiltered[i + 1 < overflowShellMenuItemsUnfiltered.Count ? i + 1 : i].ItemType != ItemType.Separator) || x.ItemType != ItemType.Separator).ToList(); var overflowItems = ItemModelListToContextFlyoutHelper.GetMenuFlyoutItemsFromModel(overflowShellMenuItems); @@ -800,6 +801,24 @@ private void AddShellItemsToMenu(List shellMenuI openWithOverflow.Visibility = Visibility.Visible; } + // Add items to sendto dropdown + var sendToOverflow = contextMenuFlyout.SecondaryCommands.FirstOrDefault(x => x is AppBarButton abb && (abb.Tag as string) == "SendToOverflow") as AppBarButton; + + var sendTo = contextMenuFlyout.SecondaryCommands.FirstOrDefault(x => x is AppBarButton abb && (abb.Tag as string) == "SendTo") as AppBarButton; + if (sendToSubItems is not null && sendToOverflow is not null) + { + var flyout = (MenuFlyout)sendToOverflow.Flyout; + + flyout.Items.Clear(); + + foreach (var item in sendToSubItems) + flyout.Items.Add(item); + + sendToOverflow.Flyout = flyout; + sendTo.Visibility = Visibility.Collapsed; + sendToOverflow.Visibility = Visibility.Visible; + } + if (itemsControl is not null) { itemsControl.Items.OfType().ForEach(item => diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index 09c9baeca77d..202c713ebf67 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -726,6 +726,32 @@ public static List GetBaseItemMenuItems(BaseLayo ShowItem = showOpenItemWith }, new ContextMenuFlyoutItemViewModel() + { + Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), + Glyph = "\uE17D", + Tag = "SendTo", + CollapseLabel = true, + ShowInSearchPage = true, + ShowItem = true + }, + new ContextMenuFlyoutItemViewModel() + { + Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), + Glyph = "\uE17D", + Tag = "SendToOverflow", + IsHidden = true, + CollapseLabel = true, + Items = new List() { + new() + { + Text = "Placeholder", + ShowInSearchPage = true, + } + }, + ShowInSearchPage = true, + ShowItem = true + }, + new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutOpenFileLocation/Text".GetLocalizedResource(), Glyph = "\uE8DA", diff --git a/src/Files.App/Helpers/ShellContextMenuHelper.cs b/src/Files.App/Helpers/ShellContextMenuHelper.cs index 9770c9378f78..7d620af294ce 100644 --- a/src/Files.App/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.App/Helpers/ShellContextMenuHelper.cs @@ -16,6 +16,7 @@ using Microsoft.UI.Xaml.Media.Imaging; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; @@ -138,6 +139,9 @@ public static void LoadMenuFlyoutItem(IList menu } else if (!string.IsNullOrEmpty(menuFlyoutItem.Label) && menuFlyoutItem.SubItems.Where(x => x.Type != MenuItemType.MFT_SEPARATOR).Any()) { + if (string.Equals(menuFlyoutItem.Label, Win32API.ExtractStringFromDLL("shell32.dll", 30312))) + menuFlyoutItem.CommandString = "sendto"; + var menuLayoutSubItem = new ContextMenuFlyoutItemViewModel() { Text = menuFlyoutItem.Label.Replace("&", "", StringComparison.Ordinal), @@ -149,14 +153,14 @@ public static void LoadMenuFlyoutItem(IList menu } else if (!string.IsNullOrEmpty(menuFlyoutItem.Label)) { - var menuLayoutItem = new ContextMenuFlyoutItemViewModel() + var menuLayoutItem = new ContextMenuFlyoutItemViewModel { Text = menuFlyoutItem.Label.Replace("&", "", StringComparison.Ordinal), Tag = menuFlyoutItem, - BitmapIcon = image + BitmapIcon = image, + Command = new RelayCommand(x => InvokeShellMenuItem(contextMenu, x)), + CommandParameter = menuFlyoutItem }; - menuLayoutItem.Command = new RelayCommand(x => InvokeShellMenuItem(contextMenu, x)); - menuLayoutItem.CommandParameter = menuFlyoutItem; menuItemsListLocal.Insert(0, menuLayoutItem); } } @@ -222,6 +226,14 @@ void InstallFont(string path, bool asAdmin) return item?.Items; } + public static List? GetSendToItems(List flyout) + { + var item = flyout.FirstOrDefault(x => x.Tag is Win32ContextMenuItem { CommandString: "sendto" }); + if (item is not null) + flyout.Remove(item); + return item?.Items; + } + public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemContextMenuFlyout, ContextMenuOptions options = null, bool showOpenWithMenu = false) { try diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index 50a272619625..711970967f7e 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -513,6 +513,9 @@ Open With + + Send To + The item name must not contain the following characters: \ / : * ? " < > | From 53bdd6d09ade7e29b38fb1f4f6320304eab1140a Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:05:26 -0500 Subject: [PATCH 2/8] Moved menu item --- .../Helpers/ContextFlyoutItemHelper.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index 202c713ebf67..a91ba8cf1997 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -726,32 +726,6 @@ public static List GetBaseItemMenuItems(BaseLayo ShowItem = showOpenItemWith }, new ContextMenuFlyoutItemViewModel() - { - Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), - Glyph = "\uE17D", - Tag = "SendTo", - CollapseLabel = true, - ShowInSearchPage = true, - ShowItem = true - }, - new ContextMenuFlyoutItemViewModel() - { - Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), - Glyph = "\uE17D", - Tag = "SendToOverflow", - IsHidden = true, - CollapseLabel = true, - Items = new List() { - new() - { - Text = "Placeholder", - ShowInSearchPage = true, - } - }, - ShowInSearchPage = true, - ShowItem = true - }, - new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutItemContextFlyoutOpenFileLocation/Text".GetLocalizedResource(), Glyph = "\uE8DA", @@ -1145,6 +1119,32 @@ public static List GetBaseItemMenuItems(BaseLayo }, }, new ContextMenuFlyoutItemViewModel() + { + Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), + Glyph = "\uE17D", + Tag = "SendTo", + CollapseLabel = true, + ShowInSearchPage = true, + ShowItem = true + }, + new ContextMenuFlyoutItemViewModel() + { + Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), + Glyph = "\uE17D", + Tag = "SendToOverflow", + IsHidden = true, + CollapseLabel = true, + Items = new List() { + new() + { + Text = "Placeholder", + ShowInSearchPage = true, + } + }, + ShowInSearchPage = true, + ShowItem = true + }, + new ContextMenuFlyoutItemViewModel() { ItemType = ItemType.Separator, Tag = "OverflowSeparator", From 8d6f80b10bd7cfcd254be1d261d8db23157bc828 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:12:54 -0500 Subject: [PATCH 3/8] Update pane icon --- src/Files.App/UserControls/SidebarControl.xaml.cs | 8 ++++++-- src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs | 8 ++++++-- .../UserControls/Widgets/QuickAccessWidget.xaml.cs | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Files.App/UserControls/SidebarControl.xaml.cs b/src/Files.App/UserControls/SidebarControl.xaml.cs index 3199067348fc..f04b88ff2ffb 100644 --- a/src/Files.App/UserControls/SidebarControl.xaml.cs +++ b/src/Files.App/UserControls/SidebarControl.xaml.cs @@ -232,8 +232,12 @@ private List GetLocationItemMenuItems(INavigatio new ContextMenuFlyoutItemViewModel() { Text = "OpenInNewPane".GetLocalizedResource(), - Glyph = "\uF117", - GlyphFontFamilyName = "CustomGlyph", + ColoredIcon = new ColoredIconModel() + { + BaseBackdropGlyph = "\uF056", + BaseLayerGlyph = "\uF03B", + OverlayLayerGlyph = "\uF03C", + }, Command = OpenInNewPaneCommand, ShowItem = options.IsLocationItem && userSettingsService.PreferencesSettingsService.ShowOpenInNewPane }, diff --git a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs index 6309915d877f..29c8378874f3 100644 --- a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs @@ -163,8 +163,12 @@ public override List GetItemMenuItems(WidgetCard new ContextMenuFlyoutItemViewModel() { Text = "OpenInNewPane".GetLocalizedResource(), - Glyph = "\uF117", - GlyphFontFamilyName = "CustomGlyph", + ColoredIcon = new ColoredIconModel() + { + BaseBackdropGlyph = "\uF056", + BaseLayerGlyph = "\uF03B", + OverlayLayerGlyph = "\uF03C", + }, Command = OpenInNewPaneCommand, CommandParameter = item, ShowItem = userSettingsService.PreferencesSettingsService.ShowOpenInNewPane diff --git a/src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs b/src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs index 11f4011ee15b..f40babaa16e8 100644 --- a/src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs @@ -176,8 +176,12 @@ public override List GetItemMenuItems(WidgetCard new ContextMenuFlyoutItemViewModel() { Text = "OpenInNewPane".GetLocalizedResource(), - Glyph = "\uF117", - GlyphFontFamilyName = "CustomGlyph", + ColoredIcon = new ColoredIconModel() + { + BaseBackdropGlyph = "\uF056", + BaseLayerGlyph = "\uF03B", + OverlayLayerGlyph = "\uF03C", + }, Command = OpenInNewPaneCommand, CommandParameter = item, ShowItem = userSettingsService.PreferencesSettingsService.ShowOpenInNewPane From 60a70027f1cd48da1004ab653047912dbe5fbf76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= <55754091+hecksmosis@users.noreply.github.com> Date: Thu, 16 Feb 2023 23:10:39 +0100 Subject: [PATCH 4/8] Update src/Files.App/Strings/en-US/Resources.resw Co-authored-by: Yair <39923744+yaira2@users.noreply.github.com> --- src/Files.App/Strings/en-US/Resources.resw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index 711970967f7e..af90df980bc2 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -513,7 +513,7 @@ Open With - + Send To From 55039ac7e4728aad1f2082b396b0cf87d64fff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= Date: Fri, 17 Feb 2023 18:21:31 +0100 Subject: [PATCH 5/8] Requested changes --- .../Helpers/ContextFlyoutItemHelper.cs | 8 +++---- .../Helpers/ShellContextMenuHelper.cs | 22 ++++++++++++++++++- .../Widgets/RecentFilesWidget.xaml.cs | 9 +++++++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index a91ba8cf1997..c645a06bd7db 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -1120,8 +1120,8 @@ public static List GetBaseItemMenuItems(BaseLayo }, new ContextMenuFlyoutItemViewModel() { - Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), - Glyph = "\uE17D", + Text = "SendTo".GetLocalizedResource(), + Glyph = "\uE72D", Tag = "SendTo", CollapseLabel = true, ShowInSearchPage = true, @@ -1129,8 +1129,8 @@ public static List GetBaseItemMenuItems(BaseLayo }, new ContextMenuFlyoutItemViewModel() { - Text = "BaseLayoutItemContextFlyoutSendTo/Text".GetLocalizedResource(), - Glyph = "\uE17D", + Text = "SendTo".GetLocalizedResource(), + Glyph = "\uE72D", Tag = "SendToOverflow", IsHidden = true, CollapseLabel = true, diff --git a/src/Files.App/Helpers/ShellContextMenuHelper.cs b/src/Files.App/Helpers/ShellContextMenuHelper.cs index d915fc71470f..68deb8f32926 100644 --- a/src/Files.App/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.App/Helpers/ShellContextMenuHelper.cs @@ -234,7 +234,12 @@ void InstallFont(string path, bool asAdmin) return item?.Items; } - public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemContextMenuFlyout, ContextMenuOptions options = null, bool showOpenWithMenu = false) + public static async Task LoadShellMenuItems( + string path, + CommandBarFlyout itemContextMenuFlyout, + ContextMenuOptions options = null, + bool showOpenWithMenu = false, + bool showSendToMenu = false) { try { @@ -281,6 +286,21 @@ public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemCo } } + if (showSendToMenu) + { + var sendToItem = shellMenuItems.Where(x => (x.Tag as Win32ContextMenuItem)?.CommandString == "sendto").ToList().FirstOrDefault(); + if (sendToItem is not null) + { + sendToItem.Glyph = "\uE72D"; + var (_, sendToItems) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(new List() { sendToItem }); + var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "SendToPlaceholder")).FirstOrDefault() as AppBarButton; + if (placeholder is not null) + placeholder.Visibility = Visibility.Collapsed; + itemContextMenuFlyout.SecondaryCommands.Insert(1, sendToItems.FirstOrDefault()); + shellMenuItems.Remove(sendToItem); + } + } + if (!UserSettingsService.PreferencesSettingsService.MoveShellExtensionsToSubMenu) { var (_, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(shellMenuItems); diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs index 55c45a4bf655..15630841741e 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -117,7 +117,7 @@ private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e) secondaryElements.ForEach(i => itemContextMenuFlyout.SecondaryCommands.Add(i)); itemContextMenuFlyout.ShowAt(recentItemsGrid, new FlyoutShowOptions { Position = e.GetPosition(recentItemsGrid) }); - _ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout, showOpenWithMenu: true); + _ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout, showOpenWithMenu: true, showSendToMenu: true); e.Handled = true; } @@ -134,6 +134,13 @@ public override List GetItemMenuItems(WidgetCard IsEnabled = false }, new ContextMenuFlyoutItemViewModel() + { + Text = "SendTo".GetLocalizedResource(), + Glyph = "\uE72D", + Tag = "SendToPlaceholder", + IsEnabled = false + }, + new ContextMenuFlyoutItemViewModel() { Text = "RecentItemRemove/Text".GetLocalizedResource(), Glyph = "\uE738", From cb379bf18ac98372a51e48c508c86509ea4597bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= <55754091+hecksmosis@users.noreply.github.com> Date: Fri, 17 Feb 2023 19:13:34 +0100 Subject: [PATCH 6/8] Update src/Files.App/Strings/en-US/Resources.resw Co-authored-by: Yair <39923744+yaira2@users.noreply.github.com> --- src/Files.App/Strings/en-US/Resources.resw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw index 7e0433685384..d1d81cb11d6f 100644 --- a/src/Files.App/Strings/en-US/Resources.resw +++ b/src/Files.App/Strings/en-US/Resources.resw @@ -514,7 +514,7 @@ Open With - Send To + Send to The item name must not contain the following characters: \ / : * ? " < > | From c633d3b748989935dd33227581cff2fc4a477e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= Date: Fri, 17 Feb 2023 19:56:16 +0100 Subject: [PATCH 7/8] Blank icon --- .../Helpers/ContextFlyoutItemHelper.cs | 2 -- .../Helpers/ShellContextMenuHelper.cs | 1 - .../UserControls/Widgets/DrivesWidget.xaml.cs | 18 +++++++++++++++++- .../Widgets/RecentFilesWidget.xaml.cs | 1 - 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs index c645a06bd7db..cd0fb1f8ccde 100644 --- a/src/Files.App/Helpers/ContextFlyoutItemHelper.cs +++ b/src/Files.App/Helpers/ContextFlyoutItemHelper.cs @@ -1121,7 +1121,6 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "SendTo".GetLocalizedResource(), - Glyph = "\uE72D", Tag = "SendTo", CollapseLabel = true, ShowInSearchPage = true, @@ -1130,7 +1129,6 @@ public static List GetBaseItemMenuItems(BaseLayo new ContextMenuFlyoutItemViewModel() { Text = "SendTo".GetLocalizedResource(), - Glyph = "\uE72D", Tag = "SendToOverflow", IsHidden = true, CollapseLabel = true, diff --git a/src/Files.App/Helpers/ShellContextMenuHelper.cs b/src/Files.App/Helpers/ShellContextMenuHelper.cs index 68deb8f32926..55c4e0ee6149 100644 --- a/src/Files.App/Helpers/ShellContextMenuHelper.cs +++ b/src/Files.App/Helpers/ShellContextMenuHelper.cs @@ -291,7 +291,6 @@ public static async Task LoadShellMenuItems( var sendToItem = shellMenuItems.Where(x => (x.Tag as Win32ContextMenuItem)?.CommandString == "sendto").ToList().FirstOrDefault(); if (sendToItem is not null) { - sendToItem.Glyph = "\uE72D"; var (_, sendToItems) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(new List() { sendToItem }); var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "SendToPlaceholder")).FirstOrDefault() as AppBarButton; if (placeholder is not null) diff --git a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs index 29c8378874f3..30cf61cc68ad 100644 --- a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs @@ -118,6 +118,8 @@ public IShellPage AppInstance public AsyncRelayCommand MapNetworkDriveCommand { get; } + public AsyncRelayCommand FormatDriveCommand { get; } + public DrivesWidget() { InitializeComponent(); @@ -135,8 +137,14 @@ public DrivesWidget() UnpinFromFavoritesCommand = new RelayCommand(UnpinFromFavorites); MapNetworkDriveCommand = new AsyncRelayCommand(DoNetworkMapDrive); DisconnectNetworkDriveCommand = new RelayCommand(DisconnectNetworkDrive); + FormatDriveCommand = new AsyncRelayCommand(FormatDrive); } - + + private async Task FormatDrive(DriveCardItem? drive) + { + + } + public override List GetItemMenuItems(WidgetCardItem item, bool isPinned) { var options = (item.Item as DriveItem)?.MenuOptions; @@ -199,6 +207,14 @@ public override List GetItemMenuItems(WidgetCard ShowItem = options?.ShowEjectDevice ?? false }, new ContextMenuFlyoutItemViewModel() + { + Text = "FormatDrive/Text".GetLocalizedResource(), + Glyph = "\uF10B", + GlyphFontFamilyName = "CustomGlyph", + Command = DisconnectNetworkDriveCommand, + CommandParameter = item + }, + new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutContextFlyoutPropertiesFolder/Text".GetLocalizedResource(), Glyph = "\uE946", diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs index 15630841741e..97acfd132dfa 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -136,7 +136,6 @@ public override List GetItemMenuItems(WidgetCard new ContextMenuFlyoutItemViewModel() { Text = "SendTo".GetLocalizedResource(), - Glyph = "\uE72D", Tag = "SendToPlaceholder", IsEnabled = false }, From a9b68353cfa92e2480281e95048d6cd671eccfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Garc=C3=ADa=20Ruiz?= Date: Fri, 17 Feb 2023 19:59:30 +0100 Subject: [PATCH 8/8] Remove unnnecessary changes --- .../UserControls/Widgets/DrivesWidget.xaml.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs index 30cf61cc68ad..c4efc48a7dfe 100644 --- a/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs @@ -118,8 +118,6 @@ public IShellPage AppInstance public AsyncRelayCommand MapNetworkDriveCommand { get; } - public AsyncRelayCommand FormatDriveCommand { get; } - public DrivesWidget() { InitializeComponent(); @@ -137,12 +135,6 @@ public DrivesWidget() UnpinFromFavoritesCommand = new RelayCommand(UnpinFromFavorites); MapNetworkDriveCommand = new AsyncRelayCommand(DoNetworkMapDrive); DisconnectNetworkDriveCommand = new RelayCommand(DisconnectNetworkDrive); - FormatDriveCommand = new AsyncRelayCommand(FormatDrive); - } - - private async Task FormatDrive(DriveCardItem? drive) - { - } public override List GetItemMenuItems(WidgetCardItem item, bool isPinned) @@ -207,14 +199,6 @@ public override List GetItemMenuItems(WidgetCard ShowItem = options?.ShowEjectDevice ?? false }, new ContextMenuFlyoutItemViewModel() - { - Text = "FormatDrive/Text".GetLocalizedResource(), - Glyph = "\uF10B", - GlyphFontFamilyName = "CustomGlyph", - Command = DisconnectNetworkDriveCommand, - CommandParameter = item - }, - new ContextMenuFlyoutItemViewModel() { Text = "BaseLayoutContextFlyoutPropertiesFolder/Text".GetLocalizedResource(), Glyph = "\uE946",