Ejemplo n.º 1
0
 public static void SetEvent(UpdateInfo info)
 {
     lock (typeof(ValuesPusherComet))
     {
         foreach (var valuesPusher in ClientList)
         {
             valuesPusher.Value.SetEvent(info);
         }
     }
 }
Ejemplo n.º 2
0
        public Stream GetChanges()
        {
            var arg = new UpdateInfo();
            string clientId = Guid.NewGuid().ToString();
            ValuesPusherComet.RegisterCometInstance(clientId, this);

            if (_ev.WaitOne(Comet.TimeOut))
            {
                lock (typeof(Comet))
                {
                    arg = _message;
                }
            }

            Comet.UnregisterCometInstance(clientId);
            var myResponseBody = JsonConvert.SerializeObject(arg);
            WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8";
            return new MemoryStream(Encoding.UTF8.GetBytes(myResponseBody));
        }
Ejemplo n.º 3
0
 internal void SetEvent(UpdateInfo message)
 {
     _message = message;
     _ev.Set();
 }
Ejemplo n.º 4
0
 private static void OnValuesChangedEvent(UpdateInfo updateInfo)
 {
     ValuesChangedHandler handler = ValuesChangedEvent;
     if (handler != null) handler(updateInfo);
 }