Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Some icons are not displayed #12033

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/Files.App/Actions/BaseUIAction.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Files.App.Helpers;
using System.ComponentModel;
using System.Threading.Tasks;

namespace Files.App.Actions
{
internal abstract class BaseUIAction : ObservableObject, IAction
internal abstract class BaseUIAction : ObservableObject
{
public abstract string Label { get; }

public abstract string Description { get; }

public virtual bool IsExecutable => UIHelpers.CanShowDialog;

public BaseUIAction()
{
UIHelpers.PropertyChanged += UIHelpers_PropertyChanged;
}

public abstract Task ExecuteAsync();

private void UIHelpers_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(UIHelpers.CanShowDialog))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace Files.App.Actions
{
internal class CompressIntoArchiveAction : BaseUIAction
internal class CompressIntoArchiveAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label => "CreateArchive".GetLocalizedResource();
public string Label => "CreateArchive".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public override bool IsExecutable =>
IsContextPageTypeAdaptedToCommand() &&
Expand All @@ -28,7 +28,7 @@ public CompressIntoArchiveAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
var (sources, directory, fileName) = ArchiveHelpers.GetCompressDestination(context.ShellPage);

Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/Content/Archives/DecompressArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Files.App.Actions
{
internal class DecompressArchive : BaseUIAction
internal class DecompressArchive : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label => "ExtractFiles".GetLocalizedResource();
public string Label => "ExtractFiles".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public HotKey HotKey { get; } = new(Keys.E, KeyModifiers.Ctrl);

Expand All @@ -28,7 +28,7 @@ public DecompressArchive()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
await ArchiveHelpers.DecompressArchive(context.ShellPage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace Files.App.Actions
{
internal class DecompressArchiveHere : BaseUIAction
internal class DecompressArchiveHere : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label => "ExtractHere".GetLocalizedResource();
public string Label => "ExtractHere".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public override bool IsExecutable =>
IsContextPageTypeAdaptedToCommand() &&
Expand All @@ -25,7 +25,7 @@ public DecompressArchiveHere()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
await ArchiveHelpers.DecompressArchiveHere(context.ShellPage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace Files.App.Actions
{
internal class DecompressArchiveToChildFolderAction : BaseUIAction
internal class DecompressArchiveToChildFolderAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label => ComputeLabel();
public string Label => ComputeLabel();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public override bool IsExecutable =>
IsContextPageTypeAdaptedToCommand() &&
Expand All @@ -27,7 +27,7 @@ public DecompressArchiveToChildFolderAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
await ArchiveHelpers.DecompressArchiveToChildFolder(context.ShellPage);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/FileSystem/CreateFolderAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace Files.App.Actions
{
internal class CreateFolderAction : BaseUIAction
internal class CreateFolderAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "Folder".GetLocalizedResource();
public string Label { get; } = "Folder".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(baseGlyph: "\uE8B7");

Expand All @@ -26,7 +26,7 @@ public CreateFolderAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override Task ExecuteAsync()
public Task ExecuteAsync()
{
if (context.ShellPage is not null)
UIFilesystemHelpers.CreateFileFromDialogResultType(AddItemDialogItemType.Folder, null!, context.ShellPage);
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/FileSystem/CreateShortcutAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace Files.App.Actions
{
internal class CreateShortcutAction : BaseUIAction
internal class CreateShortcutAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "CreateShortcut".GetLocalizedResource();
public string Label { get; } = "CreateShortcut".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconShortcut");

Expand All @@ -27,7 +27,7 @@ public CreateShortcutAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
var currentPath = context.ShellPage?.FilesystemViewModel.WorkingDirectory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Files.App.Actions
{
internal class CreateShortcutFromDialogAction : BaseUIAction
internal class CreateShortcutFromDialogAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "Shortcut".GetLocalizedResource();
public string Label { get; } = "Shortcut".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconShortcut");

Expand All @@ -25,7 +25,7 @@ public CreateShortcutFromDialogAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
await UIFilesystemHelpers.CreateShortcutFromDialogAsync(context.ShellPage);
}
Expand Down
9 changes: 5 additions & 4 deletions src/Files.App/Actions/FileSystem/DeleteItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@

namespace Files.App.Actions
{
internal class DeleteItemAction : BaseUIAction
internal class DeleteItemAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

private readonly IFoldersSettingsService settings = Ioc.Default.GetRequiredService<IFoldersSettingsService>();

public override string Label { get; } = "Delete".GetLocalizedResource();
public string Label { get; } = "Delete".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconDelete");

Expand All @@ -35,7 +36,7 @@ public DeleteItemAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
if (context.ShellPage is null || !IsExecutable)
return;
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/FileSystem/EmptyRecycleBinAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Files.App.Actions
{
internal class EmptyRecycleBinAction : BaseUIAction
internal class EmptyRecycleBinAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "EmptyRecycleBin".GetLocalizedResource();
public string Label { get; } = "EmptyRecycleBin".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconDelete");

Expand All @@ -28,7 +28,7 @@ public EmptyRecycleBinAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
await RecycleBinHelpers.EmptyRecycleBin();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

namespace Files.App.Actions
{
internal class PasteItemToSelectionAction : BaseUIAction
internal class PasteItemToSelectionAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "Paste".GetLocalizedResource();
public string Label { get; } = "Paste".GetLocalizedResource();

public override string Description => "PasteItemToSelectionDescription".GetLocalizedResource();
public string Description => "PasteItemToSelectionDescription".GetLocalizedResource();

public RichGlyph Glyph { get; } = new(opacityStyle: "ColorIconPaste");

Expand All @@ -33,7 +33,7 @@ public PasteItemToSelectionAction()
App.AppModel.PropertyChanged += AppModel_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
if (context.ShellPage is null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Files.App.Actions
{
internal class RestoreAllRecycleBinAction : BaseUIAction
internal class RestoreAllRecycleBinAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "RestoreAllItems".GetLocalizedResource();
public string Label { get; } = "RestoreAllItems".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconRestoreItem");

Expand All @@ -29,7 +29,7 @@ public RestoreAllRecycleBinAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
if (context.ShellPage is not null)
await RecycleBinHelpers.RestoreRecycleBin(context.ShellPage);
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/FileSystem/RestoreRecycleBinAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

namespace Files.App.Actions
{
internal class RestoreRecycleBinAction : BaseUIAction
internal class RestoreRecycleBinAction : BaseUIAction, IAction
{
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();

public override string Label { get; } = "Restore".GetLocalizedResource();
public string Label { get; } = "Restore".GetLocalizedResource();

public override string Description => "TODO: Need to be described.";
public string Description => "TODO: Need to be described.";

public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconRestoreItem");

Expand All @@ -29,7 +29,7 @@ public RestoreRecycleBinAction()
context.PropertyChanged += Context_PropertyChanged;
}

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
if (context.ShellPage is not null)
await RecycleBinHelpers.RestoreSelectionRecycleBin(context.ShellPage);
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/Open/OpenSettingsAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

namespace Files.App.Actions
{
internal class OpenSettingsAction : BaseUIAction
internal class OpenSettingsAction : BaseUIAction, IAction
{
private readonly IDialogService dialogService = Ioc.Default.GetRequiredService<IDialogService>();

private readonly SettingsDialogViewModel viewModel = new();

public override string Label => "Settings".GetLocalizedResource();
public string Label => "Settings".GetLocalizedResource();

public override string Description => "Settings".GetLocalizedResource();
public string Description => "Settings".GetLocalizedResource();

public HotKey HotKey { get; } = new(Keys.OemComma, KeyModifiers.Ctrl);

public override async Task ExecuteAsync()
public async Task ExecuteAsync()
{
var dialog = dialogService.GetDialog(viewModel);
await dialog.TryShowAsync();
Expand Down