private async void Check() { if (OnNewNotification == null) { return; } HueListenerEventData eventData = null; try { eventData = CreateEventDataFromLight(_webChecker.Check()); } catch (Exception ex) { eventData = new HueListenerEventData { EventType = EventType.Error, ErrorMessage = ex.Message }; } finally { if (_lastEventData == null || (eventData != null && _lastEventData.EventType != eventData.EventType)) { _lastEventData = eventData; Notify(eventData); } } }
public HueNotificationEventArgs(HueListenerEventData eventData) { HueListenerEventData = eventData; }
public void StopListener() { _lastEventData = null; _timer.Stop(); }
private void Notify(HueListenerEventData eventData) { if (OnNewNotification == null) { return; } OnNewNotification(this, new HueNotificationEventArgs(eventData)); }