// 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.Core.ViewModels.Messages; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands; /// /// Built-in Provider for a top-level command which can quit the application. Invokes the , which sends a . /// public partial class BuiltInsCommandProvider : CommandProvider { private readonly OpenSettingsCommand openSettings = 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) { Subtitle = Properties.Resources.builtin_open_settings_subtitle }, new CommandItem(_newExtension) { Title = _newExtension.Title, Subtitle = Properties.Resources.builtin_new_extension_subtitle }, ]; public override IFallbackCommandItem[] FallbackCommands() => [ new FallbackCommandItem(quitCommand, displayTitle: Properties.Resources.builtin_quit_subtitle) { Subtitle = Properties.Resources.builtin_quit_subtitle }, _fallbackReloadItem, _fallbackLogItem, ]; public BuiltInsCommandProvider() { Id = "Core"; DisplayName = Properties.Resources.builtin_display_name; Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.scale-200.png"); } public override void InitializeWithHost(IExtensionHost host) => BuiltinsExtensionHost.Instance.Initialize(host); }