/// <summary> /// Tries to connect to the server based on the given ip address and port. /// </summary> public void Connect(ConnectionData user) { try { ConnectionData = user; ConnectionCore = new ConnectionCore(IPAddress, Port, ConnectionData, this); ConnectionCore.Connect(); Console.WriteLine("Starting the Client..."); OnConnected(null); } catch (Exception e) { Debug.WriteLine(e); Console.WriteLine("Failed to connect to the server..."); OnConnectionFailed(null); Stop(); } }