/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs
59 строк
2 KB
Jiří Polášek
CmdPal: Fix "Open Command Palette" dock item (#49095)
08 июл 2026, 19:09
Не верифицирован
08 июл 2026, 19:09
99d01dc
Код
Авторство
О чём код?
// 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.CmdPal.UI.ViewModels.Commands; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands; /// <summary> /// Built-in Provider for a top-level command which can quit the application. Invokes the <see cref="QuitCommand"/>, which sends a <see cref="QuitMessage"/>. /// </summary> public sealed partial class BuiltInsCommandProvider : CommandProvider { private readonly IRootPageAccessor _rootPageAccessor; private readonly OpenSettingsCommand openSettings = new(); private readonly OpenGallerySettingsCommand openGallerySettings = new(); private readonly QuitCommand quitCommand = new(); private readonly FallbackReloadItem _fallbackReloadItem = new(); private readonly FallbackLogItem _fallbackLogItem = new(); private readonly NewExtensionPage _newExtension = new(); public override ICommandItem[] TopLevelCommands() => [ new CommandItem(openSettings) { }, new CommandItem(openGallerySettings) { }, new CommandItem(_newExtension) { Title = _newExtension.Title }, ]; public override IFallbackCommandItem[] FallbackCommands() => [ new FallbackCommandItem( quitCommand, Properties.Resources.builtin_quit_subtitle, quitCommand.Id) { Subtitle = Properties.Resources.builtin_quit_subtitle, }, _fallbackReloadItem, _fallbackLogItem, ]; public BuiltInsCommandProvider(IRootPageAccessor rootPageAccessor) { _rootPageAccessor = rootPageAccessor; Id = "com.microsoft.cmdpal.builtin.core"; DisplayName = Properties.Resources.builtin_display_name; Icon = IconHelpers.FromRelativePath("Assets\\Square44x44Logo.altform-unplated_targetsize-256.png"); } public override ICommandItem[]? GetDockBands() { var rootPage = _rootPageAccessor.GetRootPage(); return [new WrappedDockItem(rootPage, Properties.Resources.builtin_command_palette_title)]; } public override void InitializeWithHost(IExtensionHost host) => BuiltinsExtensionHost.Instance.Initialize(host); }