mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
we start now boys
This commit is contained in:
@@ -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;
|
||||
|
||||
/// <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// , 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<string, object> GetProperties()
|
||||
// {
|
||||
// var bands = _appState.TopLevelCommandBands;
|
||||
// var bandItems = new List<ICommandItem>();
|
||||
// foreach (var band in bands)
|
||||
// {
|
||||
// var item = _topLevelCommandManager.LookupCommand(band.Id);
|
||||
// if (item != null)
|
||||
// {
|
||||
// bandItems.Add(item.ToDockBandItem(showLabels: band.ShowLabels));
|
||||
// }
|
||||
// }
|
||||
public IDictionary<string, object> GetProperties()
|
||||
{
|
||||
var rootPage = _rootPageService.GetRootPage();
|
||||
List<ICommandItem> 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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user