public void Subscribe(QualityServiceEventType eventType, QualityServiceSubscribtionArgs args = null) { if (!IsSubscribed(eventType)) { lock (subscriptions) { logger.Debug("Подписка на событие [{0}]", eventType); switch (eventType) { case QualityServiceEventType.RatingAccepted: foreach (var d in Drivers) { d.Accepted += driver_Accepted; } break; } } } }
public void UnSubscribe(QualityServiceEventType eventType) { if (IsSubscribed(eventType)) { lock (subscriptions) { logger.Debug("Отписка от события [{0}]", eventType); switch (eventType) { case QualityServiceEventType.RatingAccepted: foreach (var d in Drivers) { d.Accepted -= driver_Accepted; } break; } subscriptions.Remove(eventType); } } }
public bool IsSubscribed(QualityServiceEventType eventType) { return subscriptions.ContainsKey(eventType); }