private void EnsureConnectedWithRobot() { if (_robotBombDefuser == null) { _robotBombDefuser = new RobotBombDefuser(); _robotBombDefuser.ConnectWireless(_communicationWaveLength); } for (int i = 0; i < _connectionAttempts; i++) { if (_robotBombDefuser.IsConnected() != true) { _robotBombDefuser.ConnectWireless(_communicationWaveLength); } else { break; } } if (_robotBombDefuser.IsConnected() != true) { throw new BadConnectionException("No connection with remote bomb diffuser robot could be made after few attempts."); } }
public RobotBombDefuserProxy(int communicationWaveLength) { _robotBombDefuser = new RobotBombDefuser(); _communicationWaveLength = communicationWaveLength; }