예제 #1
0
        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);
                }
            }
        }
예제 #2
0
 public HueNotificationEventArgs(HueListenerEventData eventData)
 {
     HueListenerEventData = eventData;
 }
 public HueNotificationEventArgs(HueListenerEventData eventData)
 {
     HueListenerEventData = eventData;
 }
예제 #4
0
 public void StopListener()
 {
     _lastEventData = null;
     _timer.Stop();
 }
예제 #5
0
        private void Notify(HueListenerEventData eventData)
        {
            if (OnNewNotification == null)
            {
                return;
            }

            OnNewNotification(this, new HueNotificationEventArgs(eventData));
        }