diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs index 3fdce6d391..48184281e9 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs @@ -2,15 +2,18 @@ // 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.Common.Helpers; +using Microsoft.CmdPal.Core.ViewModels; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; +using Windows.Foundation.Collections; 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 sealed partial class BuiltInsCommandProvider : CommandProvider// , IExtendedAttributesProvider +public sealed partial class BuiltInsCommandProvider : CommandProvider, IExtendedAttributesProvider { private readonly OpenSettingsCommand openSettings = new(); private readonly QuitCommand quitCommand = new(); @@ -18,8 +21,7 @@ public sealed partial class BuiltInsCommandProvider : CommandProvider// , IExten private readonly FallbackLogItem _fallbackLogItem = new(); private readonly NewExtensionPage _newExtension = new(); - private readonly AppStateModel _appState; - private readonly TopLevelCommandManager _topLevelCommandManager; + private readonly IRootPageService _rootPageService; public override ICommandItem[] TopLevelCommands() => [ @@ -34,39 +36,26 @@ public sealed partial class BuiltInsCommandProvider : CommandProvider// , IExten _fallbackLogItem, ]; - public BuiltInsCommandProvider(AppStateModel appState, TopLevelCommandManager tlcManager) + public BuiltInsCommandProvider(IRootPageService rootPageService) { Id = "com.microsoft.cmdpal.builtin.core"; DisplayName = Properties.Resources.builtin_display_name; Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.scale-200.png"); - _appState = appState; - _topLevelCommandManager = tlcManager; + _rootPageService = rootPageService; } - // public IDictionary GetProperties() - // { - // var bands = _appState.TopLevelCommandBands; - // var bandItems = new List(); - // foreach (var band in bands) - // { - // var item = _topLevelCommandManager.LookupCommand(band.Id); - // if (item != null) - // { - // bandItems.Add(item.ToDockBandItem(showLabels: band.ShowLabels)); - // } - // } + public IDictionary GetProperties() + { + var rootPage = _rootPageService.GetRootPage(); + List bandItems = new(); + bandItems.Add(new WrappedDockItem(rootPage)); - // return new PropertySet() - // { - // { "DockBands", bandItems.ToArray() }, - // }; - // } + return new PropertySet() + { + { "DockBands", bandItems.ToArray() }, + }; + } - // private void AppState_StateChanged(AppStateModel state, object? _) - // { - // // TODO! Be more precise - don't blast our bands just when any state changes - // RaiseItemsChanged(); - // } public override void InitializeWithHost(IExtensionHost host) => BuiltinsExtensionHost.Instance.Initialize(host); } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs index 996475d559..2b1c970ca1 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs @@ -55,6 +55,7 @@ public partial class MainListPage : DynamicListPage, public MainListPage(IServiceProvider serviceProvider) { + Id = "com.microsoft.cmdpal.home"; Title = Resources.builtin_home_name; Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.scale-200.png"); PlaceholderText = Properties.Resources.builtin_main_list_page_searchbar_placeholder;