private void StartCometClientAsync(object state)
        {
            CometClient client = (CometClient)state;

            client.Stop();
            client.Start();
        }
Beispiel #2
0
 public void Stop()
 {
     if (this.comet != null)
     {
         this.isStopping = true;
         this.comet.Stop();
         this.comet.InvalidUrl       -= this.comet_InvalidUrl;
         this.comet.Connected        -= this.comet_Connected;
         this.comet.Disconnected     -= this.comet_Disconnected;
         this.comet.ResponseReceived -= this.comet_ResponseReceived;
         this.comet.Dispose();
         this.comet = null;
     }
 }
 public void Stop()
 {
     if (this.comet != null)
     {
         this.isStopping = true;
         this.comet.Stop();
         this.comet.InvalidUrl       -= new EventHandler(comet_InvalidUrl);
         this.comet.Connected        -= new EventHandler(comet_Connected);
         this.comet.Disconnected     -= new EventHandler(comet_Disconnected);
         this.comet.ResponseReceived -= new CometClient.ResponseReceivedEventHandler(comet_ResponseReceived);
         this.comet.Dispose();
         this.comet = null;
     }
 }
Beispiel #4
0
        public void Start()

        {
            if (!this.isStopping)

            {
                this.isStopping = false;



                //string url = String.Format("http://api.notify.io/v1/listen/{0}?api_key={1}", this.hash, this.apiKey);

                //string url = "http://api.notify.io/v1/listen/a56bd4435f989f8d7447f737e24991519ea94652";

                //http://www.notify.io/outlets/a56bd4435f989f8d7447f737e24991519ea94652.ListenURL



                string url = this.outletUrl;



                if (this.comet == null)

                {
                    this.comet = new CometClient(url);

                    comet.InvalidUrl += new EventHandler(comet_InvalidUrl);

                    comet.Connected += new EventHandler(comet_Connected);

                    comet.Disconnected += new EventHandler(comet_Disconnected);

                    comet.ResponseReceived += new CometClient.ResponseReceivedEventHandler(comet_ResponseReceived);
                }



                StartCometClient(comet, 0);
            }
        }
Beispiel #5
0
        private void StartCometClient(CometClient client, int wait)
        {
            /*
             * if (this.synchronizingObject != null && this.synchronizingObject.InvokeRequired)
             * {
             *  MethodInvoker invoker = new MethodInvoker(delegate()
             *  {
             *      StartCometClient(client, wait);
             *  });
             *
             *  this.synchronizingObject.Invoke(invoker, null);
             * }
             * else
             * {
             *  client.Stop();
             *  client.Start();
             * }
             * */

            System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(StartCometClientAsync), client);
        }
 public void Stop()
 {
     if (this.comet != null)
     {
         this.isStopping = true;
         this.comet.Stop();
         this.comet.InvalidUrl -= new EventHandler(comet_InvalidUrl);
         this.comet.Connected -= new EventHandler(comet_Connected);
         this.comet.Disconnected -= new EventHandler(comet_Disconnected);
         this.comet.ResponseReceived -= new CometClient.ResponseReceivedEventHandler(comet_ResponseReceived);
         this.comet.Dispose();
         this.comet = null;
     }
 }
        public void Start()
        {
            if (!this.isStopping)
            {
                this.isStopping = false;

                //string url = String.Format("http://api.notify.io/v1/listen/{0}?api_key={1}", this.hash, this.apiKey);
                //string url = "http://api.notify.io/v1/listen/a56bd4435f989f8d7447f737e24991519ea94652";
                //http://www.notify.io/outlets/a56bd4435f989f8d7447f737e24991519ea94652.ListenURL

                string url = this.outletUrl;

                if (this.comet == null)
                {
                    this.comet = new CometClient(url);
                    comet.InvalidUrl += new EventHandler(comet_InvalidUrl);
                    comet.Connected += new EventHandler(comet_Connected);
                    comet.Disconnected += new EventHandler(comet_Disconnected);
                    comet.ResponseReceived += new CometClient.ResponseReceivedEventHandler(comet_ResponseReceived);
                }

                StartCometClient(comet, 0);
            }
        }
        private void StartCometClient(CometClient client, int wait)
        {
            /*
            if (this.synchronizingObject != null && this.synchronizingObject.InvokeRequired)
            {
                MethodInvoker invoker = new MethodInvoker(delegate()
                {
                    StartCometClient(client, wait);
                });

                this.synchronizingObject.Invoke(invoker, null);
            }
            else
            {
                client.Stop();
                client.Start();
            }
             * */

            System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(StartCometClientAsync), client);
        }