Moved all PInvokes to a lower class without any relianceon WPF, NotificationIconHelper, TaskbarHelper, SystemPersonalisationHelper are WPF window no more

This commit is contained in:
Daniel Clark
2021-02-13 17:08:00 +00:00
parent 20441d5749
commit ce314678b5
57 changed files with 800 additions and 588 deletions
@@ -0,0 +1,21 @@
using System;
using System.Linq;
namespace NotificationFlyout.Shared.UI.Helpers
{
public class WndProcHandlerSubscriber : IWndProcHandlerSubscriber
{
private static readonly Lazy<WndProcHandlerSubscriber> _current = new(() => new WndProcHandlerSubscriber());
public static WndProcHandlerSubscriber Current => _current.Value;
public void Subscribe<TWndProcHandler>(TWndProcHandler handler) where TWndProcHandler : IWndProcHandler
{
var handlers = WndProcHandlerCollection.Current;
lock (handlers)
{
if (handlers.Any(x => x.Matches(handler))) return;
handlers.Add(new WndProcHandlerReference(handler));
}
}
}
}