Ejemplo n.º 1
0
        public void Connect()
        {
            var c = new CancelEventArgs();

            Connecting.Fire(this, c);

            if (c.Cancel)
            {
                ConnectCancelled.Fire(this, EventArgs.Empty);
                return;
            }

            //Don't attept to connect more often than once a second
            if (DateTime.Now - _serverChangeTime < TimeSpan.FromSeconds(1))
            {
                var th = new Thread(() =>
                {
                    Thread.Sleep(TimeSpan.FromSeconds(1));
                    Connection.Connect();
                });
                th.Start();
            }
            else
            {
                Connection.Connect();
            }
        }