[PowerToys Run] Fix register notifications crash (#12911)

This commit is contained in:
Jaime Bernardo 2021-08-26 17:35:28 +01:00 committed by GitHub
parent c1127b3667
commit 078cf2c22f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Windows;
using ManagedCommon;
using Microsoft.PowerToys.Common.UI;
@ -16,6 +17,7 @@ using PowerLauncher.ViewModel;
using Windows.UI.Notifications;
using Wox.Infrastructure.Image;
using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Wox
{
@ -37,7 +39,14 @@ namespace Wox
WebRequest.RegisterPrefix("data", new DataWebRequestFactory());
DesktopNotificationManagerCompat.RegisterActivator<LauncherNotificationActivator>();
DesktopNotificationManagerCompat.RegisterAumidAndComServer<LauncherNotificationActivator>("PowerToysRun");
try
{
DesktopNotificationManagerCompat.RegisterAumidAndComServer<LauncherNotificationActivator>("PowerToysRun");
}
catch (System.UnauthorizedAccessException ex)
{
Log.Exception("Exception calling RegisterAumidAndComServer. Notifications not available.", ex, MethodBase.GetCurrentMethod().DeclaringType);
}
}
public void ChangeQuery(string query, bool requery = false)