Esempio n. 1
0
        /// <summary>
        /// Connect and Login to an ARCL server.
        /// Hides SocketManager.Connect()
        /// </summary>
        /// <param name="timeout">How long to wait for a connection.</param>
        /// <returns>Conenction or Login failed / succeeded</returns>
        public new bool Connect(int timeout = 3000)
        {
            if (base.Connect(timeout))
            {
                if (Login())
                {
                    base.ConnectState += ARCLConnection_ConnectState;

                    this.QueueTask("State", false, new Action(() => ConnectState?.Invoke(this, true)));

                    return(true);
                }
                else
                {
                    base.Close();
                }
            }
            else
            {
                base.Close();
            }

            this.QueueTask("State", false, new Action(() => ConnectState?.Invoke(this, false)));
            return(false);
        }
Esempio n. 2
0
        private void ARCLConnection_ConnectState(object sender, bool state)
        {
            if (!state)
            {
                base.ConnectState -= ARCLConnection_ConnectState;
            }

            this.QueueTask("State", false, new Action(() => ConnectState?.Invoke(sender, state)));
        }