static void Main() { Client = new Client("127.0.0.1", 13000); StartMessageHandleThread(); while (IsApplicationExecuting) { Console.WriteLine("(l) Login with existing account"); Console.WriteLine("(r) Register a new account"); var loginRegisterInput = Console.ReadKey(); if (loginRegisterInput.Key == ConsoleKey.L) { Console.Clear(); Console.WriteLine("Login:"******"Username: "******"Password: "******"Connecting to server."); Client.Connect(username, password); while (Client.IsConnecting) { } if (Client.IsConnected) { Client.CheckSavedMessages(username); } while (Client.IsConnected) { Console.WriteLine("Nachricht eingeben:"); var input = Console.ReadLine(); if (input.StartsWith("/user") && input != "/users") { ReturnId(input); } else if (input.StartsWith("/message")) { Client.SendDirectMessage(input); continue; } else { switch (input) { case "/users": PrintUsers(); break; case "/disconnect": Client.Disconnect(); break; case "/exit": Client.Disconnect(); IsApplicationExecuting = false; break; default: Client.SendChatMessage(input); break; } } } } if (loginRegisterInput.Key == ConsoleKey.R) { Console.Clear(); Console.WriteLine("Register"); Console.WriteLine("Username: "******"Password: "); var password = Console.ReadLine(); Client.Register(username, password); } } }