Пример #1
0
        public void StateChanged(object sender, DDConnectionStateChangedEventArgs e)
        {
            logger.LogDebug("State changed: {0}", e.State);

            switch (e.State)
            {
            case DDConnectionState.Connected:
                _client.Authenticate(_connectioninfo.Credential.Context, _connectioninfo.Credential.Username, _connectioninfo.Credential.Password);
                break;

            case DDConnectionState.AuthenticationSucceeded:
                _isauthenticated = true;
                break;

            case DDConnectionState.ConnectionTimedOut:
            case DDConnectionState.ConnectionLost:
                if (_isauthenticated || _reconnect)       //Retry dropped/failed connections if we were authenticated or when reconnect is used
                {
                    this.Connect(_connectioninfo);
                }
                _reconnect = false;
                break;
            }

            foreach (var o in _registeredobjects)
            {
                o.StateChanged(sender, e);
            }
        }
Пример #2
0
 public void Dial(string numberToDial)
 {
     logger.LogDebug("Dialing: {0}", numberToDial);
     _client.Dial(numberToDial);
 }