private void EnsureConnectWithRobot() { if (_robotDefuser == null) { _robotDefuser = new RobotBombDefuser(); _robotDefuser.ConnectWireless(_communicationWavelenght); } for (int i = 0; i < _connectionAttempts; i++) { if (_robotDefuser.IsConnected() != true) { _robotDefuser.ConnectWireless(_communicationWavelenght); } else { break; } if (_robotDefuser.IsConnected() != true) { throw new Exception("No connection with robot..."); } } }
public RobotBombDefuserProxy(int communicationWavelenght) { _robotDefuser = new RobotBombDefuser(); _communicationWavelenght = communicationWavelenght; }