mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
prepare aot
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
|
|
||||||
namespace PowerToysExtension.Commands;
|
namespace PowerToysExtension.Commands;
|
||||||
@@ -30,7 +29,7 @@ internal sealed partial class CopyColorCommand : InvokableCommand
|
|||||||
return CommandResult.ShowToast("No color found in Color Picker history.");
|
return CommandResult.ShowToast("No color found in Color Picker history.");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Windows.Forms.Clipboard.SetText(color);
|
ClipboardHelper.SetText(color);
|
||||||
return CommandResult.ShowToast($"Copied {color}");
|
return CommandResult.ShowToast($"Copied {color}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using ColorPicker.ModuleServices;
|
using ColorPicker.ModuleServices;
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
|
|
||||||
@@ -30,29 +27,7 @@ internal sealed partial class CopySavedColorCommand : InvokableCommand
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
|
ClipboardHelper.SetText(_copyValue);
|
||||||
{
|
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
|
||||||
var thread = new Thread(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Clipboard.SetText(_copyValue);
|
|
||||||
tcs.SetResult(true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
tcs.SetException(ex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
thread.SetApartmentState(ApartmentState.STA);
|
|
||||||
thread.Start();
|
|
||||||
tcs.Task.GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Clipboard.SetText(_copyValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CommandResult.ShowToast($"Copied {_copyValue}");
|
return CommandResult.ShowToast($"Copied {_copyValue}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
||||||
<UseWinUI>false</UseWinUI>
|
<UseWinUI>false</UseWinUI>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>false</UseWindowsForms>
|
||||||
<EnableMsixTooling>true</EnableMsixTooling>
|
<EnableMsixTooling>true</EnableMsixTooling>
|
||||||
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
|
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
|
||||||
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPalExtensions\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPalExtensions\$(MSBuildProjectName)\</OutputPath>
|
||||||
@@ -64,15 +64,12 @@
|
|||||||
|
|
||||||
<!-- Exclude legacy Helper folder in favor of Helpers -->
|
<!-- Exclude legacy Helper folder in favor of Helpers -->
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
<PropertyGroup>
|
||||||
<PublishTrimmed>true</PublishTrimmed>
|
<!-- Always build/publish AOT so the extension ships as native code -->
|
||||||
<PublishSingleFile>true</PublishSingleFile>
|
<SelfContained>true</SelfContained>
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
|
||||||
<PublishTrimmed>false</PublishTrimmed>
|
|
||||||
<PublishSingleFile>false</PublishSingleFile>
|
<PublishSingleFile>false</PublishSingleFile>
|
||||||
<PublishAot>false</PublishAot>
|
<PublishTrimmed>true</PublishTrimmed>
|
||||||
|
<DisableRuntimeMarshalling>false</DisableRuntimeMarshalling>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user