public int Connect(string host)
{
// If not connected - try to connect
if (!_connected)
{
try
{
_clientId = VREPWrapper.simxStart(host, 19997, true, true, 5000, 5);
}
catch (DllNotFoundException)
{
MessageBox.Show(R.ErrorMessage_DLL);
}
// Successfully connected to V-REP
if (_clientId != -1)
{
Debug.WriteLine("Connected to V-REP");
_connected = true;
return 0;
}
Debug.WriteLine("Error connecting to V-REP");
MessageBox.Show("Error connecting to V-REP");
_connected = false;
return -1;
}
Disconnect();
Debug.WriteLine("Disconnected from V-REP");
_connected = false;
return -2;
}