Exemple #1
0
 void eventSource_EventReceived(object sender, ServerSentEventReceivedEventArgs e)
 {
     if (string.Compare(e.Message.EventType, "spark/status", true) == 0)
     {
         OnEventReceived(e);
     }
 }
Exemple #2
0
 protected virtual void OnEventReceived(ServerSentEventReceivedEventArgs e)
 {
     if (EventReceived != null)
     {
         EventReceived(this, e);
     }
 }
        private void OnSlackMessageReceived(object o, ServerSentEventReceivedEventArgs e)
        {
            var jsonData   = e.Message.Data;
            var serializer = new DataContractJsonSerializer(typeof(SlackMessage));

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(jsonData)))
            {
                var data = (SlackMessage)serializer.ReadObject(stream);
                SlackMessage.OnNext(data);
            }
        }
Exemple #4
0
        private void eventClient_EventReceived(object sender, ServerSentEventReceivedEventArgs e)
        {
            Event  eventObject = JsonConvert.DeserializeObject <Event> (e.Message.Data);
            Module module      = GetModule(eventObject.Domain, eventObject.Source);

            if (module != null)
            {
                ModuleParameter property = module.GetProperty(eventObject.Property);
                if (property != null)
                {
                    module.SetProperty(property, eventObject.Value, eventObject.Timestamp);
                }
            }
        }
 private void _eventSource_EventReceived(object sender, ServerSentEventReceivedEventArgs e)
 {
     OnReceived?.Invoke(this, new EventArgs());
 }