Skip to content

Commit

Permalink
Code Quality: Added workaround for open with icon to display correctly (
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu committed Mar 18, 2024
1 parent 39c2f9c commit 0965661
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/Files.App/Actions/FileSystem/OpenItemAction.cs
Expand Up @@ -62,9 +62,8 @@ public string Label
public string Description
=> "OpenItemWithApplicationPickerDescription".GetLocalizedResource();

// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
//public RichGlyph Glyph
// => new(opacityStyle: "ColorIconOpenWith");
public RichGlyph Glyph
=> new(opacityStyle: "ColorIconOpenWith");

public bool IsExecutable =>
context.HasSelection &&
Expand Down
Expand Up @@ -378,8 +378,8 @@ private static bool Check(ContextMenuFlyoutItemViewModel item, CurrentInstanceVi
}.Build(),
new ContextMenuFlyoutItemViewModel()
{
Text = "OpenWith".GetLocalizedResource(),
// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
// TODO add back text and icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
//Text = "OpenWith".GetLocalizedResource(),
//OpacityIcon = new OpacityIconModel()
//{
// OpacityIconStyle = "ColorIconOpenWith"
Expand Down
9 changes: 4 additions & 5 deletions src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs
Expand Up @@ -336,11 +336,10 @@ async Task InvokeShellMenuItemAsync(ContextMenu contextMenu, object? tag)
{
await openWithItem.LoadSubMenuAction();

// TODO add back icon when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
//openWithItem.OpacityIcon = new OpacityIconModel()
//{
// OpacityIconStyle = "ColorIconOpenWith",
//};
openWithItem.OpacityIcon = new OpacityIconModel()
{
OpacityIconStyle = "ColorIconOpenWith",
};
var (_, openWithItems) = ContextFlyoutModelToElementHelper.GetAppBarItemsFromModel(new List<ContextMenuFlyoutItemViewModel>() { openWithItem });
var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "OpenWithPlaceholder")).FirstOrDefault() as AppBarButton;
if (placeholder is not null)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Files.App.csproj
Expand Up @@ -88,7 +88,7 @@
<PackageReference Include="SevenZipSharp" Version="1.0.2" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.1.1" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />
Expand Down
7 changes: 7 additions & 0 deletions src/Files.App/Views/Layouts/BaseLayoutPage.cs
Expand Up @@ -864,6 +864,13 @@ private async Task AddShellMenuItemsAsync(List<ContextMenuFlyoutItemViewModel> s
openWithOverflow.Flyout = flyout;
openWith.Visibility = Visibility.Collapsed;
openWithOverflow.Visibility = Visibility.Visible;

// TODO delete this when https://github.com/microsoft/microsoft-ui-xaml/issues/9409 is resolved
openWithOverflow.Content = new OpacityIconModel()
{
OpacityIconStyle = "ColorIconOpenWith"
}.ToOpacityIcon();
openWithOverflow.Label = "OpenWith".GetLocalizedResource();
}
}

Expand Down

0 comments on commit 0965661

Please sign in to comment.