mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
CmdPal: Move core projects into Core/ (#41358)
Couple little things here: * Makes `Microsoft.CmdPal.Common` a `Core` project * Moves the `CmdPal.Core` projects into a single `Core/` directory * Adds the `CoreLogger` which I had stashed in https://github.com/microsoft/PowerToys/compare/dev/migrie/40113/extension-hosts-try-2...dev/migrie/b/remove-core-managedcommon-dep a while back * De-duplicates a bunch of commands that were in both Apps and Common * moves all the commands into the toolkit, instead of in the Common project
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// 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 System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using Windows.AI.Actions.Hosting;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Indexer.Commands;
|
||||
|
||||
public sealed partial class ExecuteActionCommand : InvokableCommand
|
||||
{
|
||||
private readonly ActionInstance actionInstance;
|
||||
|
||||
public ExecuteActionCommand(ActionInstance actionInstance)
|
||||
{
|
||||
this.actionInstance = actionInstance;
|
||||
this.Name = actionInstance.DisplayInfo.Description;
|
||||
this.Icon = new IconInfo(actionInstance.Definition.IconFullPath);
|
||||
}
|
||||
|
||||
public override CommandResult Invoke()
|
||||
{
|
||||
var task = Task.Run(InvokeAsync);
|
||||
task.Wait();
|
||||
|
||||
return task.Result;
|
||||
}
|
||||
|
||||
private async Task<CommandResult> InvokeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await actionInstance.InvokeAsync();
|
||||
return CommandResult.GoHome();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CommandResult.ShowToast("Failed to invoke action " + actionInstance.Definition.Id + ": " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.CmdPal.Common.Commands;
|
||||
using Microsoft.CmdPal.Core.Common.Commands;
|
||||
using Microsoft.CmdPal.Ext.Indexer.Pages;
|
||||
using Microsoft.CmdPal.Ext.Indexer.Properties;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.Common.Helpers;
|
||||
using Microsoft.CmdPal.Core.Common.Helpers;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Indexer;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</PackageReference>
|
||||
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\common\ManagedCsWin32\ManagedCsWin32.csproj" />
|
||||
<ProjectReference Include="..\..\Microsoft.CmdPal.Common\Microsoft.CmdPal.Common.csproj" />
|
||||
<ProjectReference Include="..\..\Core\Microsoft.CmdPal.Core.Common\Microsoft.CmdPal.Core.Common.csproj" />
|
||||
<!-- CmdPal Toolkit reference now included via Common.ExtDependencies.props -->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CmdPal.Common.Commands;
|
||||
using Microsoft.CmdPal.Core.Common.Commands;
|
||||
using Microsoft.CmdPal.Ext.Indexer.Data;
|
||||
using Microsoft.CmdPal.Ext.Indexer.Properties;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
Reference in New Issue
Block a user