Пример #1
0
        private void OnNotificationClosed(BaseNotification notification)
        {
            if (notification is null)
            {
                return;
            }

            notification.Closed -= OnNotificationClosed;


            // remove associated config
            if (_configs.TryGetValue(notification, out var config) && config != null)
            {
                config.Created -= OnNotificationCreated;
                _configs.Remove(notification);
            }

            NotificationChanged?.Invoke(this, new NotificationChanged(ChangeType.Remove, notification));
        }
Пример #2
0
        private void OnNotificationCreated(BaseNotification baseNotification)
        {
            if (baseNotification is null)
            {
                return;
            }

            baseNotification.Closed += OnNotificationClosed;

            switch (baseNotification)
            {
            case Notification notification:
                _notifications.Add(notification);
                break;

            case TaskNotification taskNotification:
                _tasks.Add(taskNotification);
                break;
            }

            NotificationChanged?.Invoke(this, new NotificationChanged(ChangeType.Add, baseNotification));
        }