[PT Run] Service Plugin (#8076)

* PT Run service plugin

* icon, localization and fixes

* basic toast notification

* service start mode

* improved keys

* fixed setup

* improvements

* added _ keyword
* better shortcuts
* action for open services.msc

* pt run service plugin dll signing

* renamed Microsoft.Plugin.Service

* changed output dir

* set ! action keyword

* launcher dll

Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
Davide Giacometti
2021-01-06 11:40:07 +01:00
committed by GitHub
parent f0600f1725
commit 3a87c4909c
18 changed files with 1071 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
// 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.Runtime.InteropServices;
using Microsoft.Toolkit.Uwp.Notifications;
namespace PowerLauncher.Helper
{
[ClassInterface(ClassInterfaceType.None)]
#pragma warning disable CS0618 // Type or member is obsolete
[ComSourceInterfaces(typeof(INotificationActivationCallback))]
#pragma warning restore CS0618 // Type or member is obsolete
[Guid("DD5CACDA-7C2E-4997-A62A-04A597B58F76")]
[ComVisible(true)]
public class LauncherNotificationActivator : NotificationActivator
{
public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
{
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Import Project="..\..\..\Version.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
@@ -100,6 +100,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="6.1.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NuGet.CommandLine" Version="5.7.0">
@@ -113,6 +114,7 @@
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.6" />
<PackageReference Include="System.Data.OleDb" Version="4.7.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
@@ -175,6 +177,9 @@
<None Update="Images\history.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\image.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// 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.
@@ -9,9 +9,11 @@ using System.Net;
using System.Windows;
using ManagedCommon;
using Microsoft.PowerToys.Common.UI;
using Microsoft.Toolkit.Uwp.Notifications;
using PowerLauncher.Helper;
using PowerLauncher.Plugin;
using PowerLauncher.ViewModel;
using Windows.UI.Notifications;
using Wox.Infrastructure.Image;
using Wox.Plugin;
@@ -33,6 +35,9 @@ namespace Wox
_themeManager = themeManager ?? throw new ArgumentNullException(nameof(themeManager));
_themeManager.ThemeChanged += OnThemeChanged;
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
DesktopNotificationManagerCompat.RegisterActivator<LauncherNotificationActivator>();
DesktopNotificationManagerCompat.RegisterAumidAndComServer<LauncherNotificationActivator>("PowerToysRun");
}
public void ChangeQuery(string query, bool requery = false)
@@ -79,6 +84,18 @@ namespace Wox
});
}
public void ShowNotification(string text)
{
Application.Current.Dispatcher.Invoke(() =>
{
ToastContent toastContent = new ToastContentBuilder()
.AddText(text)
.GetToastContent();
var toast = new ToastNotification(toastContent.GetXml());
DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
});
}
public void InstallPlugin(string path)
{
Application.Current.Dispatcher.Invoke(() => PluginManager.InstallPlugin(path));