using System; using System.Collections.Generic; using System.Text; namespace InABox.Core.Notifications { public class Notifications { private Dictionary Handlers = new Dictionary(); public void AddHandler(NotificationHandler handler) { Handlers[typeof(TNotification)] = handler; } public void AddHandler(NotificationHandler.ReceiveEvent receive) { Handlers[typeof(TNotification)] = new NotificationHandler(receive); } public void Notify(Type type, object? notification) { if (Handlers.TryGetValue(type, out var handler)) { handler.Receive(notification); } } } }