Example #1
0
 private bool isConnected()
 {
     try
     {
         if (_client != null && _client.IsConnected)
         {
             return(true);
         }
         var instance = new EngineLocator().GetInstance(_path);
         if (instance == null)
         {
             return(false);
         }
         _client = new SocketClient();
         _client.IncomingMessage += Handle_clientIncomingMessage;
         _client.Connect(instance.Port);
         if (_client.IsConnected)
         {
             return(true);
         }
         _client = null;
         return(false);
     }
     catch (Exception ex)
     {
         Debug.WriteError(ex.ToString());
         return(false);
     }
 }
		private bool isConnected()
		{
			try
			{
				if (_client != null && _client.IsConnected)
					return true;
				var instance = new EngineLocator().GetInstance(_path);
				if (instance == null)
					return false;
				_client = new SocketClient();
				_client.IncomingMessage += Handle_clientIncomingMessage;
				_client.Connect(instance.Port);
				if (_client.IsConnected)
					return true;
				_client = null;
				return false;
			}
			catch (Exception ex)
			{
				Debug.WriteError(ex.ToString());
				return false;
			}
		}