mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
More deux...
This commit is contained in:
@@ -18,7 +18,7 @@ public partial class AppStateService
|
|||||||
|
|
||||||
public AppStateModel CurrentSettings => _appStateModel;
|
public AppStateModel CurrentSettings => _appStateModel;
|
||||||
|
|
||||||
public AppStateService(ILogger<SettingsService> logger)
|
public AppStateService(ILogger logger)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
_filePath = PersistenceService.SettingsJsonPath("state.json");
|
_filePath = PersistenceService.SettingsJsonPath("state.json");
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
||||||
|
|
||||||
internal class BuiltInExtensionService : IExtensionService
|
public class BuiltInExtensionService : IExtensionService
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
||||||
|
|
||||||
internal interface IExtensionService
|
public interface IExtensionService
|
||||||
{
|
{
|
||||||
|
CommandViewModel
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
namespace Microsoft.CommandPalette.UI.Services.Extensions;
|
||||||
|
|
||||||
internal class WinRTExtensionService : IExtensionService
|
public class WinRTExtensionService : IExtensionService
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public partial class SettingsService
|
|||||||
|
|
||||||
public SettingsModel CurrentSettings => _settingsModel;
|
public SettingsModel CurrentSettings => _settingsModel;
|
||||||
|
|
||||||
public SettingsService(ILogger<SettingsService> logger)
|
public SettingsService(ILogger logger)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
_filePath = PersistenceService.SettingsJsonPath("settings.json");
|
_filePath = PersistenceService.SettingsJsonPath("settings.json");
|
||||||
|
|||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
using Microsoft.CommandPalette.UI.Helpers;
|
using Microsoft.CommandPalette.UI.Helpers;
|
||||||
using Microsoft.CommandPalette.UI.Pages;
|
using Microsoft.CommandPalette.UI.Pages;
|
||||||
using Microsoft.CommandPalette.UI.Services;
|
using Microsoft.CommandPalette.UI.Services;
|
||||||
|
using Microsoft.CommandPalette.UI.Services.Extensions;
|
||||||
using Microsoft.CommandPalette.ViewModels;
|
using Microsoft.CommandPalette.ViewModels;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@@ -31,7 +32,6 @@ public partial class App : Application
|
|||||||
|
|
||||||
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
|
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
|
||||||
|
|
||||||
|
|
||||||
public App(ILogger logger)
|
public App(ILogger logger)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@@ -70,6 +70,15 @@ public partial class App : Application
|
|||||||
services.AddSingleton<SettingsService>();
|
services.AddSingleton<SettingsService>();
|
||||||
services.AddSingleton<AppStateService>();
|
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
|
// Register services
|
||||||
services.AddSingleton<TrayIconService>();
|
services.AddSingleton<TrayIconService>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user