FallbackReloadItem.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using Microsoft.CommandPalette.Extensions.Toolkit; 6 7 namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands; 8 9 internal sealed partial class FallbackReloadItem : FallbackCommandItem 10 { 11 private readonly ReloadExtensionsCommand _reloadCommand; 12 13 private const string _id = "com.microsoft.cmdpal.reload"; 14 15 public FallbackReloadItem() 16 : base( 17 new ReloadExtensionsCommand() { Id = _id }, 18 Properties.Resources.builtin_reload_display_title, 19 _id) 20 { 21 _reloadCommand = (ReloadExtensionsCommand)Command!; 22 Title = string.Empty; 23 Subtitle = Properties.Resources.builtin_reload_subtitle; 24 } 25 26 public override void UpdateQuery(string query) 27 { 28 _reloadCommand.Name = query.StartsWith("r", StringComparison.OrdinalIgnoreCase) ? "Reload" : string.Empty; 29 Title = _reloadCommand.Name; 30 } 31 }