internal async Task <Boolean> Connect() { Boolean flag; Debug.WriteLine(String.Concat("Connecting: ", _info.DisplayName)); try { if (_info == null) { Debug.WriteLine(String.Concat("Unable to build Service for ", this)); flag = false; return(flag); } } catch (Exception exception1) { Exception exception = exception1; Debug.WriteLine(String.Concat("Exception looking up service ", _info.DisplayName, " ", exception.Message)); flag = false; return(flag); } var dispatcher = Deployment.Current.Dispatcher; _session = new RobotSession(_info, this, dispatcher); if (!await _session.Initialize()) { flag = false; } else { InternalSetConnectionState(ConnectionState.Connected); Debug.WriteLine(String.Concat("Connected: ", ToString())); _sensorControl = new SensorControl(_session); _collisionControl = new CollisionControl(_session); _session._responseDelegate = new RobotSession.RobotResponseDelegate(OnResponseReceived); flag = true; } return(flag); }
internal async Task<Boolean> Connect() { Boolean flag; Debug.WriteLine(String.Concat("Connecting: ", _info.DisplayName)); try { if (_info == null) { Debug.WriteLine(String.Concat("Unable to build Service for ", this)); flag = false; return flag; } } catch (Exception exception1) { Exception exception = exception1;Debug.WriteLine(String.Concat("Exception looking up service ", _info.DisplayName, " ", exception.Message)); flag = false; return flag; } var dispatcher = Deployment.Current.Dispatcher; _session = new RobotSession(_info, this, dispatcher); if (!await _session.Initialize()) { flag = false; } else { InternalSetConnectionState(ConnectionState.Connected); Debug.WriteLine(String.Concat("Connected: ", ToString())); _sensorControl = new SensorControl(_session); _collisionControl = new CollisionControl(_session); _session._responseDelegate = new RobotSession.RobotResponseDelegate(OnResponseReceived); flag = true; } return flag; }