private void BntLogin(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBoxPassword.Text) || string.IsNullOrWhiteSpace(textBoxUsername.Text)) { return; } //Laver json objekt Message JsonObject = new Message { Password = textBoxPassword.Text, Username = textBoxUsername.Text, Function = "Login" }; //tømmer textbox textBoxUsername.Clear(); textBoxPassword.Clear(); ServerFunctions ServerFunctions = new ServerFunctions(); ServerFunctions.AddToQueue(JsonObject); Running = true; while (Running) { if (Valid) { Running = false; UI ui = new UI(); ui.Show(); this.Hide(); } } }