mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Standardizing built-in extension icon handling (#40606)
Just standardizing built-in extensions to use a `internal sealed class Icons` for all their non-dynamic icons. Looks like a LOT of changes, but it's icons all the way down.
This commit is contained in:
@@ -25,7 +25,7 @@ internal sealed partial class AddBookmarkPage : ContentPage
|
||||
{
|
||||
var name = bookmark?.Name ?? string.Empty;
|
||||
var url = bookmark?.Bookmark ?? string.Empty;
|
||||
Icon = IconHelpers.FromRelativePath("Assets\\Bookmark.svg");
|
||||
Icon = Icons.BookmarkIcon;
|
||||
var isAdd = string.IsNullOrEmpty(name) && string.IsNullOrEmpty(url);
|
||||
Title = isAdd ? Resources.bookmarks_add_title : Resources.bookmarks_edit_name;
|
||||
Name = isAdd ? Resources.bookmarks_add_name : Resources.bookmarks_edit_name;
|
||||
|
||||
@@ -23,15 +23,11 @@ public partial class BookmarksCommandProvider : CommandProvider
|
||||
|
||||
private Bookmarks? _bookmarks;
|
||||
|
||||
public static IconInfo DeleteIcon { get; private set; } = new("\uE74D"); // Delete
|
||||
|
||||
public static IconInfo EditIcon { get; private set; } = new("\uE70F"); // Edit
|
||||
|
||||
public BookmarksCommandProvider()
|
||||
{
|
||||
Id = "Bookmarks";
|
||||
DisplayName = Resources.bookmarks_display_name;
|
||||
Icon = new IconInfo("\uE718"); // Pin
|
||||
Icon = Icons.PinIcon;
|
||||
|
||||
_addNewCommand.AddedCommand += AddNewCommand_AddedCommand;
|
||||
}
|
||||
@@ -132,7 +128,7 @@ public partial class BookmarksCommandProvider : CommandProvider
|
||||
listItem.Subtitle = urlCommand.Url;
|
||||
}
|
||||
|
||||
var edit = new AddBookmarkPage(bookmark) { Icon = EditIcon };
|
||||
var edit = new AddBookmarkPage(bookmark) { Icon = Icons.EditIcon };
|
||||
edit.AddedCommand += Edit_AddedCommand;
|
||||
contextMenu.Add(new CommandContextItem(edit));
|
||||
|
||||
@@ -153,7 +149,7 @@ public partial class BookmarksCommandProvider : CommandProvider
|
||||
result: CommandResult.KeepOpen())
|
||||
{
|
||||
IsCritical = true,
|
||||
Icon = DeleteIcon,
|
||||
Icon = Icons.DeleteIcon,
|
||||
};
|
||||
contextMenu.Add(delete);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Bookmarks;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo BookmarkIcon => IconHelpers.FromRelativePath("Assets\\Bookmark.svg");
|
||||
|
||||
internal static IconInfo DeleteIcon { get; private set; } = new("\uE74D"); // Delete
|
||||
|
||||
internal static IconInfo EditIcon { get; private set; } = new("\uE70F"); // Edit
|
||||
|
||||
internal static IconInfo PinIcon { get; private set; } = new IconInfo("\uE718"); // Pin
|
||||
}
|
||||
Reference in New Issue
Block a user