More deux...

This commit is contained in:
Michael Jolley
2025-12-10 17:04:03 -06:00
parent 82a63a4517
commit 4c1b822948
8 changed files with 50 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ public partial class AppStateService
public AppStateModel CurrentSettings => _appStateModel;
public AppStateService(ILogger<SettingsService> logger)
public AppStateService(ILogger logger)
{
this.logger = logger;
_filePath = PersistenceService.SettingsJsonPath("state.json");

View File

@@ -4,6 +4,6 @@
namespace Microsoft.CommandPalette.UI.Services.Extensions;
internal class BuiltInExtensionService : IExtensionService
public class BuiltInExtensionService : IExtensionService
{
}

View File

@@ -4,6 +4,7 @@
namespace Microsoft.CommandPalette.UI.Services.Extensions;
internal interface IExtensionService
public interface IExtensionService
{
CommandViewModel
}

View File

@@ -0,0 +1,9 @@
// 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.
namespace Microsoft.CommandPalette.UI.Services.Extensions;
public class JsonRPCExtensionService : IExtensionService
{
}

View File

@@ -4,6 +4,6 @@
namespace Microsoft.CommandPalette.UI.Services.Extensions;
internal class WinRTExtensionService : IExtensionService
public class WinRTExtensionService : IExtensionService
{
}

View File

@@ -22,7 +22,7 @@ public partial class SettingsService
public SettingsModel CurrentSettings => _settingsModel;
public SettingsService(ILogger<SettingsService> logger)
public SettingsService(ILogger logger)
{
this.logger = logger;
_filePath = PersistenceService.SettingsJsonPath("settings.json");

View File

@@ -0,0 +1,25 @@
// 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 CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Windows.Foundation;
namespace Microsoft.CmdPal.UI.ViewModels;
public sealed partial class CommandViewModel : ObservableObject
{
public string Title { get; set; } = string.Empty;
public string Subtitle { get; set; } = string.Empty;
public IIconInfo Icon { get; set; }
public Details Details { get; set; }
public event TypedEventHandler<object, IPropChangedEventArgs>? PropChanged;
public bool IsEnabled { get; set; }
}

View File

@@ -5,6 +5,7 @@
using Microsoft.CommandPalette.UI.Helpers;
using Microsoft.CommandPalette.UI.Pages;
using Microsoft.CommandPalette.UI.Services;
using Microsoft.CommandPalette.UI.Services.Extensions;
using Microsoft.CommandPalette.ViewModels;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -31,7 +32,6 @@ public partial class App : Application
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
public App(ILogger logger)
{
this.logger = logger;
@@ -70,6 +70,15 @@ public partial class App : Application
services.AddSingleton<SettingsService>();
services.AddSingleton<AppStateService>();
// Register extension services
// We do these before other services so that they are available
// during initialization of other services. Technically, they should
// be registered before other services require them, but this is
// a simple way to ensure that.
services.AddSingleton<IExtensionService, BuiltInExtensionService>();
services.AddSingleton<IExtensionService, WinRTExtensionService>();
services.AddSingleton<IExtensionService, JsonRPCExtensionService>();
// Register services
services.AddSingleton<TrayIconService>();