コード例 #1
0
 void eventSource_EventReceived(object sender, ServerSentEventReceivedEventArgs e)
 {
     if (string.Compare(e.Message.EventType, "spark/status", true) == 0)
     {
         OnEventReceived(e);
     }
 }
コード例 #2
0
ファイル: Protocol.cs プロジェクト: redmondgeek/beakn
 protected virtual void OnEventReceived(ServerSentEventReceivedEventArgs e)
 {
     if (EventReceived != null)
     {
         EventReceived(this, e);
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #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);
                }
            }
        }
コード例 #5
0
 private void _eventSource_EventReceived(object sender, ServerSentEventReceivedEventArgs e)
 {
     OnReceived?.Invoke(this, new EventArgs());
 }